mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-16 09:31:14 +00:00
parent
0a5579cdd6
commit
216ecd7e07
6 changed files with 44 additions and 5 deletions
|
@ -79,6 +79,11 @@ void PolyTriangleDrawer::SetCullCCW(const DrawerCommandQueuePtr &queue, bool ccw
|
|||
queue->Push<PolySetCullCCWCommand>(ccw);
|
||||
}
|
||||
|
||||
void PolyTriangleDrawer::SetWeaponScene(const DrawerCommandQueuePtr &queue, bool enable)
|
||||
{
|
||||
queue->Push<PolySetWeaponSceneCommand>(enable);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void PolyTriangleThreadData::SetViewport(int x, int y, int width, int height, uint8_t *new_dest, int new_dest_width, int new_dest_height, int new_dest_pitch, bool new_dest_bgra, bool new_span_drawers)
|
||||
|
@ -94,6 +99,7 @@ void PolyTriangleThreadData::SetViewport(int x, int y, int width, int height, ui
|
|||
dest_bgra = new_dest_bgra;
|
||||
span_drawers = new_span_drawers;
|
||||
ccw = true;
|
||||
weaponScene = false;
|
||||
}
|
||||
|
||||
void PolyTriangleThreadData::SetTransform(const Mat4f *newObjectToClip)
|
||||
|
@ -117,6 +123,7 @@ void PolyTriangleThreadData::DrawElements(const PolyDrawArgs &drawargs)
|
|||
args.stencilValues = PolyStencilBuffer::Instance()->Values();
|
||||
args.stencilMasks = PolyStencilBuffer::Instance()->Masks();
|
||||
args.zbuffer = PolyZBuffer::Instance()->Values();
|
||||
args.depthOffset = weaponScene ? 1.0f : 0.0f;
|
||||
|
||||
const TriVertex *vinput = drawargs.Vertices();
|
||||
const unsigned int *elements = drawargs.Elements();
|
||||
|
@ -175,6 +182,7 @@ void PolyTriangleThreadData::DrawArrays(const PolyDrawArgs &drawargs)
|
|||
args.stencilValues = PolyStencilBuffer::Instance()->Values();
|
||||
args.stencilMasks = PolyStencilBuffer::Instance()->Masks();
|
||||
args.zbuffer = PolyZBuffer::Instance()->Values();
|
||||
args.depthOffset = weaponScene ? 1.0f : 0.0f;
|
||||
|
||||
const TriVertex *vinput = drawargs.Vertices();
|
||||
int vcount = drawargs.VertexCount();
|
||||
|
@ -580,6 +588,17 @@ void PolySetCullCCWCommand::Execute(DrawerThread *thread)
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PolySetWeaponSceneCommand::PolySetWeaponSceneCommand(bool value) : value(value)
|
||||
{
|
||||
}
|
||||
|
||||
void PolySetWeaponSceneCommand::Execute(DrawerThread *thread)
|
||||
{
|
||||
PolyTriangleThreadData::Get(thread)->SetWeaponScene(value);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PolySetViewportCommand::PolySetViewportCommand(int x, int y, int width, int height, uint8_t *dest, int dest_width, int dest_height, int dest_pitch, bool dest_bgra, bool span_drawers)
|
||||
: x(x), y(y), width(width), height(height), dest(dest), dest_width(dest_width), dest_height(dest_height), dest_pitch(dest_pitch), dest_bgra(dest_bgra), span_drawers(span_drawers)
|
||||
{
|
||||
|
|
|
@ -35,6 +35,7 @@ public:
|
|||
static void ClearBuffers(DCanvas *canvas);
|
||||
static void SetViewport(const DrawerCommandQueuePtr &queue, int x, int y, int width, int height, DCanvas *canvas, bool span_drawers);
|
||||
static void SetCullCCW(const DrawerCommandQueuePtr &queue, bool ccw);
|
||||
static void SetWeaponScene(const DrawerCommandQueuePtr &queue, bool enable);
|
||||
static void SetTransform(const DrawerCommandQueuePtr &queue, const Mat4f *objectToClip);
|
||||
};
|
||||
|
||||
|
@ -46,6 +47,7 @@ public:
|
|||
void SetViewport(int x, int y, int width, int height, uint8_t *dest, int dest_width, int dest_height, int dest_pitch, bool dest_bgra, bool span_drawers);
|
||||
void SetTransform(const Mat4f *objectToClip);
|
||||
void SetCullCCW(bool value) { ccw = value; }
|
||||
void SetWeaponScene(bool value) { weaponScene = value; }
|
||||
|
||||
void DrawElements(const PolyDrawArgs &args);
|
||||
void DrawArrays(const PolyDrawArgs &args);
|
||||
|
@ -79,6 +81,7 @@ private:
|
|||
bool dest_bgra = false;
|
||||
uint8_t *dest = nullptr;
|
||||
bool ccw = true;
|
||||
bool weaponScene = false;
|
||||
const Mat4f *objectToClip = nullptr;
|
||||
bool span_drawers = false;
|
||||
|
||||
|
@ -109,6 +112,18 @@ private:
|
|||
bool ccw;
|
||||
};
|
||||
|
||||
class PolySetWeaponSceneCommand : public DrawerCommand
|
||||
{
|
||||
public:
|
||||
PolySetWeaponSceneCommand(bool value);
|
||||
|
||||
void Execute(DrawerThread *thread) override;
|
||||
FString DebugInfo() override { return "PolySetWeaponSceneCommand"; }
|
||||
|
||||
private:
|
||||
bool value;
|
||||
};
|
||||
|
||||
class PolySetViewportCommand : public DrawerCommand
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -365,7 +365,7 @@ void TriangleBlock::DepthTest(const TriDrawTriangleArgs *args)
|
|||
|
||||
float stepXW = args->gradientX.W;
|
||||
float stepYW = args->gradientY.W;
|
||||
float posYW = v1.w + stepXW * (X - v1.x) + stepYW * (Y - v1.y);
|
||||
float posYW = v1.w + stepXW * (X - v1.x) + stepYW * (Y - v1.y) + args->depthOffset;
|
||||
|
||||
uint32_t mask0 = 0;
|
||||
uint32_t mask1 = 0;
|
||||
|
@ -413,7 +413,7 @@ void TriangleBlock::DepthTest(const TriDrawTriangleArgs *args)
|
|||
|
||||
float stepXW = args->gradientX.W;
|
||||
float stepYW = args->gradientY.W;
|
||||
float posYW = v1.w + stepXW * (X - v1.x) + stepYW * (Y - v1.y);
|
||||
float posYW = v1.w + stepXW * (X - v1.x) + stepYW * (Y - v1.y) + args->depthOffset;
|
||||
|
||||
__m128 mposYW = _mm_setr_ps(posYW, posYW + stepXW, posYW + stepXW + stepXW, posYW + stepXW + stepXW + stepXW);
|
||||
__m128 mstepXW = _mm_set1_ps(stepXW * 4.0f);
|
||||
|
@ -959,7 +959,7 @@ void TriangleBlock::DepthWrite(const TriDrawTriangleArgs *args)
|
|||
|
||||
float stepXW = args->gradientX.W;
|
||||
float stepYW = args->gradientY.W;
|
||||
float posYW = v1.w + stepXW * (X - v1.x) + stepYW * (Y - v1.y);
|
||||
float posYW = v1.w + stepXW * (X - v1.x) + stepYW * (Y - v1.y) + args->depthOffset;
|
||||
|
||||
if (Mask0 == 0xffffffff && Mask1 == 0xffffffff)
|
||||
{
|
||||
|
@ -1020,7 +1020,7 @@ void TriangleBlock::DepthWrite(const TriDrawTriangleArgs *args)
|
|||
|
||||
float stepXW = args->gradientX.W;
|
||||
float stepYW = args->gradientY.W;
|
||||
float posYW = v1.w + stepXW * (X - v1.x) + stepYW * (Y - v1.y);
|
||||
float posYW = v1.w + stepXW * (X - v1.x) + stepYW * (Y - v1.y) + args->depthOffset;
|
||||
|
||||
__m128 mposYW = _mm_setr_ps(posYW, posYW + stepXW, posYW + stepXW + stepXW, posYW + stepXW + stepXW + stepXW);
|
||||
__m128 mstepXW = _mm_set1_ps(stepXW * 4.0f);
|
||||
|
@ -1180,7 +1180,7 @@ void ScreenTriangle::DrawSWRender(const TriDrawTriangleArgs *args, PolyTriangleT
|
|||
|
||||
float startX = x + (0.5f - v1X);
|
||||
float startY = y + (0.5f - v1Y);
|
||||
float posXW = v1W + stepXW * startX + args->gradientY.W * startY;
|
||||
float posXW = v1W + stepXW * startX + args->gradientY.W * startY + args->depthOffset;
|
||||
|
||||
#ifndef NO_SSE
|
||||
__m128 mstepXW = _mm_set1_ps(stepXW * 4.0f);
|
||||
|
|
|
@ -60,6 +60,7 @@ struct TriDrawTriangleArgs
|
|||
bool destBgra;
|
||||
ScreenTriangleStepVariables gradientX;
|
||||
ScreenTriangleStepVariables gradientY;
|
||||
float depthOffset;
|
||||
|
||||
bool CalculateGradients()
|
||||
{
|
||||
|
|
|
@ -105,11 +105,13 @@ void PolyModelRenderer::BeginDrawHUDModel(AActor *actor, const VSMatrix &objectT
|
|||
ModelActor = actor;
|
||||
const_cast<VSMatrix &>(objectToWorldMatrix).copy(ObjectToWorld.Matrix);
|
||||
SetTransform();
|
||||
PolyTriangleDrawer::SetWeaponScene(Thread->DrawQueue, true);
|
||||
}
|
||||
|
||||
void PolyModelRenderer::EndDrawHUDModel(AActor *actor)
|
||||
{
|
||||
ModelActor = nullptr;
|
||||
PolyTriangleDrawer::SetWeaponScene(Thread->DrawQueue, false);
|
||||
}
|
||||
|
||||
void PolyModelRenderer::SetInterpolation(double interpolation)
|
||||
|
|
|
@ -155,11 +155,13 @@ namespace swrenderer
|
|||
ModelActor = actor;
|
||||
const_cast<VSMatrix &>(objectToWorldMatrix).copy(ObjectToWorld.Matrix);
|
||||
SetTransform();
|
||||
PolyTriangleDrawer::SetWeaponScene(Thread->DrawQueue, true);
|
||||
}
|
||||
|
||||
void SWModelRenderer::EndDrawHUDModel(AActor *actor)
|
||||
{
|
||||
ModelActor = nullptr;
|
||||
PolyTriangleDrawer::SetWeaponScene(Thread->DrawQueue, false);
|
||||
}
|
||||
|
||||
void SWModelRenderer::SetInterpolation(double interpolation)
|
||||
|
|
Loading…
Reference in a new issue