mirror of https://github.com/AxioDL/metaforce.git
Various rendering fixes
This commit is contained in:
parent
ca5cf5c77c
commit
8b9f073635
|
@ -1455,7 +1455,8 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
|
|||
}
|
||||
|
||||
/* Track alpha values for DXT1 eligibility */
|
||||
bool doDXT1 = (colorType == PNG_COLOR_TYPE_RGB || colorType == PNG_COLOR_TYPE_RGB_ALPHA) && width >= 4 && height >= 4;
|
||||
bool doDXT = (colorType == PNG_COLOR_TYPE_RGB || colorType == PNG_COLOR_TYPE_RGB_ALPHA) && width >= 4 && height >= 4;
|
||||
bool doDXT3 = false;
|
||||
|
||||
/* Read and make RGBA */
|
||||
for (int r = height - 1; r >= 0; --r) {
|
||||
|
@ -1499,7 +1500,9 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
|
|||
bufOut[outbase + 2] = rowBuf[inbase + 2];
|
||||
bufOut[outbase + 3] = rowBuf[inbase + 3];
|
||||
if (rowBuf[inbase + 3] != 0 && rowBuf[inbase + 3] != 255)
|
||||
doDXT1 = false;
|
||||
doDXT = false;
|
||||
else if (rowBuf[inbase + 3] == 0)
|
||||
doDXT3 = true;
|
||||
}
|
||||
break;
|
||||
case PNG_COLOR_TYPE_PALETTE:
|
||||
|
@ -1521,7 +1524,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
|
|||
unsigned filterWidth = width;
|
||||
unsigned filterHeight = height;
|
||||
for (size_t i = 1; i < numMips; ++i) {
|
||||
BoxFilter(filterIn, nComps, filterWidth, filterHeight, filterOut, doDXT1);
|
||||
BoxFilter(filterIn, nComps, filterWidth, filterHeight, filterOut, doDXT);
|
||||
filterIn += filterWidth * filterHeight * nComps;
|
||||
filterWidth /= 2;
|
||||
filterHeight /= 2;
|
||||
|
@ -1529,15 +1532,16 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
|
|||
}
|
||||
}
|
||||
|
||||
/* Do DXT1 compression */
|
||||
/* Do DXT compression */
|
||||
std::unique_ptr<uint8_t[]> compOut;
|
||||
size_t compLen = 0;
|
||||
if (doDXT1) {
|
||||
if (doDXT) {
|
||||
int compFlags = doDXT3 ? squish::kDxt3 : squish::kDxt1;
|
||||
int filterWidth = width;
|
||||
int filterHeight = height;
|
||||
size_t i;
|
||||
for (i = 0; i < numMips; ++i) {
|
||||
compLen += squish::GetStorageRequirements(filterWidth, filterHeight, squish::kDxt1);
|
||||
compLen += squish::GetStorageRequirements(filterWidth, filterHeight, compFlags);
|
||||
if (filterWidth == 4 || filterHeight == 4) {
|
||||
++i;
|
||||
break;
|
||||
|
@ -1554,8 +1558,8 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
|
|||
const uint8_t* rgbaIn = bufOut.get();
|
||||
uint8_t* blocksOut = compOut.get();
|
||||
for (i = 0; i < numMips; ++i) {
|
||||
int thisLen = squish::GetStorageRequirements(filterWidth, filterHeight, squish::kDxt1);
|
||||
squish::CompressImage(rgbaIn, filterWidth, filterHeight, blocksOut, squish::kDxt1);
|
||||
int thisLen = squish::GetStorageRequirements(filterWidth, filterHeight, compFlags);
|
||||
squish::CompressImage(rgbaIn, filterWidth, filterHeight, blocksOut, compFlags);
|
||||
rgbaIn += filterWidth * filterHeight * nComps;
|
||||
blocksOut += thisLen;
|
||||
filterWidth /= 2;
|
||||
|
@ -1574,7 +1578,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
|
|||
if (paletteBuf && paletteSize)
|
||||
format = 17;
|
||||
else if (compOut)
|
||||
format = 18;
|
||||
format = doDXT3 ? 19 : 18;
|
||||
else
|
||||
format = 16;
|
||||
outf.writeInt32Big(format);
|
||||
|
|
|
@ -63,27 +63,17 @@ void CGraphics::SetAmbientColor(const zeus::CColor& col) {
|
|||
|
||||
void CGraphics::SetFog(ERglFogMode mode, float startz, float endz, const zeus::CColor& color) {
|
||||
g_Fog.m_mode = mode > ERglFogMode::PerspRevExp2 ? ERglFogMode(int(mode) - 8) : mode;
|
||||
switch (g_Fog.m_mode) {
|
||||
case ERglFogMode::None: {
|
||||
g_Fog.m_start = 4096.f;
|
||||
g_Fog.m_rangeScale = 0.f;
|
||||
break;
|
||||
}
|
||||
case ERglFogMode::PerspRevExp:
|
||||
case ERglFogMode::PerspRevExp2: {
|
||||
float userRange = endz - startz;
|
||||
g_Fog.m_color = color;
|
||||
g_Fog.m_start = endz;
|
||||
g_Fog.m_rangeScale = 1.f / userRange;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
float userRange = endz - startz;
|
||||
g_Fog.m_color = color;
|
||||
g_Fog.m_start = startz;
|
||||
g_Fog.m_rangeScale = 1.f / userRange;
|
||||
break;
|
||||
}
|
||||
g_Fog.m_color = color;
|
||||
if (CGraphics::g_Proj.x18_far == CGraphics::g_Proj.x14_near || endz == startz) {
|
||||
g_Fog.m_A = 0.f;
|
||||
g_Fog.m_B = 0.5f;
|
||||
g_Fog.m_C = 0.f;
|
||||
} else {
|
||||
float depthrange = CGraphics::g_Proj.x18_far - CGraphics::g_Proj.x14_near;
|
||||
float fogrange = endz - startz;
|
||||
g_Fog.m_A = (CGraphics::g_Proj.x18_far * CGraphics::g_Proj.x14_near) / (depthrange * fogrange);
|
||||
g_Fog.m_B = CGraphics::g_Proj.x18_far / depthrange;
|
||||
g_Fog.m_C = startz / fogrange;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -165,6 +165,7 @@ enum class ETexelFormat {
|
|||
RGBA8PC = 16,
|
||||
C8PC = 17,
|
||||
CMPRPC = 18,
|
||||
CMPRPCA = 19,
|
||||
};
|
||||
|
||||
#define DEPTH_FAR 1.f
|
||||
|
@ -191,8 +192,9 @@ public:
|
|||
struct CFogState {
|
||||
ERglFogMode m_mode;
|
||||
zeus::CColor m_color;
|
||||
float m_rangeScale = 0.f;
|
||||
float m_start = 4096.f;
|
||||
float m_A = 0.f;
|
||||
float m_B = 0.5f;
|
||||
float m_C = 0.f;
|
||||
};
|
||||
|
||||
static CProjectionState g_Proj;
|
||||
|
|
|
@ -107,7 +107,7 @@ void CLineRenderer::Reset() {
|
|||
|
||||
void CLineRenderer::AddVertex(const zeus::CVector3f& position, const zeus::CColor& color, float width,
|
||||
const zeus::CVector2f& uv) {
|
||||
if (m_final || !m_shaderBind || m_nextVert >= m_maxVerts)
|
||||
if (m_final || !m_shaderBind[0] || m_nextVert >= m_maxVerts)
|
||||
return;
|
||||
|
||||
float adjWidth = width / 480.f;
|
||||
|
@ -237,7 +237,7 @@ void CLineRenderer::AddVertex(const zeus::CVector3f& position, const zeus::CColo
|
|||
++m_nextVert;
|
||||
}
|
||||
|
||||
void CLineRenderer::Render(const zeus::CColor& moduColor) {
|
||||
void CLineRenderer::Render(bool alphaWrite, const zeus::CColor& moduColor) {
|
||||
if (!m_final && m_nextVert > 1) {
|
||||
if (m_mode == EPrimitiveMode::LineLoop) {
|
||||
{
|
||||
|
@ -366,18 +366,18 @@ void CLineRenderer::Render(const zeus::CColor& moduColor) {
|
|||
m_final = true;
|
||||
}
|
||||
|
||||
m_uniformBuf.access() = SDrawUniform{moduColor};
|
||||
m_uniformBuf.access() = SDrawUniform{moduColor, CGraphics::g_Fog};
|
||||
if (m_textured) {
|
||||
if (!g_StaticLineVertsTex.empty()) {
|
||||
memmove(m_vertBufTex.access(), g_StaticLineVertsTex.data(), sizeof(SDrawVertTex) * g_StaticLineVertsTex.size());
|
||||
CGraphics::SetShaderDataBinding(m_shaderBind);
|
||||
CGraphics::SetShaderDataBinding(m_shaderBind[alphaWrite]);
|
||||
CGraphics::DrawArray(0, g_StaticLineVertsTex.size());
|
||||
}
|
||||
} else {
|
||||
if (!g_StaticLineVertsNoTex.empty()) {
|
||||
memmove(m_vertBufNoTex.access(), g_StaticLineVertsNoTex.data(),
|
||||
sizeof(SDrawVertNoTex) * g_StaticLineVertsNoTex.size());
|
||||
CGraphics::SetShaderDataBinding(m_shaderBind);
|
||||
CGraphics::SetShaderDataBinding(m_shaderBind[alphaWrite]);
|
||||
CGraphics::DrawArray(0, g_StaticLineVertsNoTex.size());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "boo/graphicsdev/IGraphicsDataFactory.hpp"
|
||||
#include "hecl/VertexBufferPool.hpp"
|
||||
#include "hecl/UniformBufferPool.hpp"
|
||||
#include "Graphics/CGraphics.hpp"
|
||||
|
||||
namespace urde {
|
||||
|
||||
|
@ -27,6 +28,7 @@ public:
|
|||
|
||||
struct SDrawUniform {
|
||||
zeus::CColor moduColor;
|
||||
CGraphics::CFogState fog;
|
||||
};
|
||||
|
||||
private:
|
||||
|
@ -61,7 +63,7 @@ public:
|
|||
hecl::VertexBufferPool<SDrawVertTex>::Token m_vertBufTex;
|
||||
hecl::VertexBufferPool<SDrawVertNoTex>::Token m_vertBufNoTex;
|
||||
hecl::UniformBufferPool<SDrawUniform>::Token m_uniformBuf;
|
||||
boo::ObjToken<boo::IShaderDataBinding> m_shaderBind;
|
||||
boo::ObjToken<boo::IShaderDataBinding> m_shaderBind[2];
|
||||
|
||||
CLineRenderer(boo::IGraphicsDataFactory::Context& ctx, EPrimitiveMode mode, u32 maxVerts,
|
||||
const boo::ObjToken<boo::ITexture>& texture, bool additive, bool zTest = false, bool zGEqual = false);
|
||||
|
@ -72,7 +74,7 @@ public:
|
|||
void Reset();
|
||||
void AddVertex(const zeus::CVector3f& position, const zeus::CColor& color, float width,
|
||||
const zeus::CVector2f& uv = zeus::skZero2f);
|
||||
void Render(const zeus::CColor& moduColor = zeus::skWhite);
|
||||
void Render(bool alphaWrite = false, const zeus::CColor& moduColor = zeus::skWhite);
|
||||
|
||||
static void UpdateBuffers() {
|
||||
s_vertPoolTex.updateBuffers();
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "CRainSplashGenerator.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
#include "World/CWorld.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "Graphics/CBooRenderer.hpp"
|
||||
|
||||
namespace urde {
|
||||
|
||||
|
@ -32,7 +34,7 @@ void CRainSplashGenerator::SSplashLine::Draw(float alpha, float dt, const zeus::
|
|||
vt += delta;
|
||||
m_renderer.AddVertex(vec, zeus::CColor(1.f, vertAlpha), 1);
|
||||
}
|
||||
m_renderer.Render();
|
||||
m_renderer.Render(g_Renderer->IsThermalVisorHotPass());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ private:
|
|||
void BuildC8(const void* data, size_t length);
|
||||
void BuildC8Font(const void* data, EFontType ftype);
|
||||
void BuildDXT1(const void* data, size_t length);
|
||||
void BuildDXT3(const void* data, size_t length);
|
||||
|
||||
public:
|
||||
CTexture(ETexelFormat, s16, s16, s32);
|
||||
|
|
|
@ -686,6 +686,15 @@ void CTexture::BuildDXT1(const void* data, size_t length) {
|
|||
} BooTrace);
|
||||
}
|
||||
|
||||
void CTexture::BuildDXT3(const void* data, size_t length) {
|
||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
m_booTex =
|
||||
ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::DXT3, boo::TextureClampMode::Repeat, data, length)
|
||||
.get();
|
||||
return true;
|
||||
} BooTrace);
|
||||
}
|
||||
|
||||
CTexture::CTexture(ETexelFormat fmt, s16 w, s16 h, s32 mips) : x0_fmt(fmt), x4_w(w), x6_h(h), x8_mips(mips) {
|
||||
/*
|
||||
x64_ = sMangleMipmaps;
|
||||
|
@ -746,6 +755,9 @@ CTexture::CTexture(std::unique_ptr<u8[]>&& in, u32 length, bool otex) {
|
|||
case ETexelFormat::CMPRPC:
|
||||
BuildDXT1(owned.get() + 12, length - 12);
|
||||
break;
|
||||
case ETexelFormat::CMPRPCA:
|
||||
BuildDXT3(owned.get() + 12, length - 12);
|
||||
break;
|
||||
default:
|
||||
Log.report(logvisor::Fatal, "invalid texture type %d for boo", int(x0_fmt));
|
||||
}
|
||||
|
|
|
@ -4,92 +4,116 @@
|
|||
|
||||
namespace urde {
|
||||
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texZTestZWrite;
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texNoZTestZWrite;
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texZTestNoZWrite;
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texNoZTestNoZWrite;
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texAdditiveZTest;
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texAdditiveNoZTest;
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texRedToAlphaZTest;
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texRedToAlphaNoZTest;
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texZTestNoZWriteSub;
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texNoZTestNoZWriteSub;
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texRedToAlphaZTestSub;
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texRedToAlphaNoZTestSub;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texZTestZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texNoZTestZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texZTestNoZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texNoZTestNoZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texAdditiveZTest;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texAdditiveNoZTest;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texRedToAlphaZTest;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texRedToAlphaNoZTest;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texZTestNoZWriteSub;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texNoZTestNoZWriteSub;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texRedToAlphaZTestSub;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texRedToAlphaNoZTestSub;
|
||||
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_indTexZWrite;
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_indTexNoZWrite;
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_indTexAdditive;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_indTexZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_indTexNoZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_indTexAdditive;
|
||||
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_cindTexZWrite;
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_cindTexNoZWrite;
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_cindTexAdditive;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_cindTexZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_cindTexNoZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_cindTexAdditive;
|
||||
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_noTexZTestZWrite;
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_noTexNoZTestZWrite;
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_noTexZTestNoZWrite;
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_noTexNoZTestNoZWrite;
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_noTexAdditiveZTest;
|
||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_noTexAdditiveNoZTest;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_noTexZTestZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_noTexNoZTestZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_noTexZTestNoZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_noTexNoZTestNoZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_noTexAdditiveZTest;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_noTexAdditiveNoZTest;
|
||||
|
||||
void CElementGenShaders::Initialize() {
|
||||
m_texZTestZWrite = hecl::conv->convert(Shader_CElementGenShaderTexZTestZWrite{});
|
||||
m_texNoZTestZWrite = hecl::conv->convert(Shader_CElementGenShaderTexNoZTestZWrite{});
|
||||
m_texZTestNoZWrite = hecl::conv->convert(Shader_CElementGenShaderTexZTestNoZWrite{});
|
||||
m_texNoZTestNoZWrite = hecl::conv->convert(Shader_CElementGenShaderTexNoZTestNoZWrite{});
|
||||
m_texAdditiveZTest = hecl::conv->convert(Shader_CElementGenShaderTexAdditiveZTest{});
|
||||
m_texAdditiveNoZTest = hecl::conv->convert(Shader_CElementGenShaderTexAdditiveNoZTest{});
|
||||
m_texRedToAlphaZTest = hecl::conv->convert(Shader_CElementGenShaderTexRedToAlphaZTest{});
|
||||
m_texRedToAlphaNoZTest = hecl::conv->convert(Shader_CElementGenShaderTexRedToAlphaNoZTest{});
|
||||
m_texZTestNoZWriteSub = hecl::conv->convert(Shader_CElementGenShaderTexZTestNoZWriteSub{});
|
||||
m_texNoZTestNoZWriteSub = hecl::conv->convert(Shader_CElementGenShaderTexNoZTestNoZWriteSub{});
|
||||
m_texRedToAlphaZTestSub = hecl::conv->convert(Shader_CElementGenShaderTexRedToAlphaZTestSub{});
|
||||
m_texRedToAlphaNoZTestSub = hecl::conv->convert(Shader_CElementGenShaderTexRedToAlphaNoZTestSub{});
|
||||
m_texZTestZWrite = {hecl::conv->convert(Shader_CElementGenShaderTexZTestZWrite{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderTexZTestZWrite{})};
|
||||
m_texNoZTestZWrite = {hecl::conv->convert(Shader_CElementGenShaderTexNoZTestZWrite{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderTexNoZTestZWriteAWrite{})};
|
||||
m_texZTestNoZWrite = {hecl::conv->convert(Shader_CElementGenShaderTexZTestNoZWrite{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderTexZTestNoZWriteAWrite{})};
|
||||
m_texNoZTestNoZWrite = {hecl::conv->convert(Shader_CElementGenShaderTexNoZTestNoZWrite{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderTexNoZTestNoZWriteAWrite{})};
|
||||
m_texAdditiveZTest = {hecl::conv->convert(Shader_CElementGenShaderTexAdditiveZTest{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderTexAdditiveZTestAWrite{})};
|
||||
m_texAdditiveNoZTest = {hecl::conv->convert(Shader_CElementGenShaderTexAdditiveNoZTest{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderTexAdditiveNoZTestAWrite{})};
|
||||
m_texRedToAlphaZTest = {hecl::conv->convert(Shader_CElementGenShaderTexRedToAlphaZTest{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderTexRedToAlphaZTestAWrite{})};
|
||||
m_texRedToAlphaNoZTest = {hecl::conv->convert(Shader_CElementGenShaderTexRedToAlphaNoZTest{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderTexRedToAlphaNoZTestAWrite{})};
|
||||
m_texZTestNoZWriteSub = {hecl::conv->convert(Shader_CElementGenShaderTexZTestNoZWriteSub{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderTexZTestNoZWriteSubAWrite{})};
|
||||
m_texNoZTestNoZWriteSub = {hecl::conv->convert(Shader_CElementGenShaderTexNoZTestNoZWriteSub{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderTexNoZTestNoZWriteSubAWrite{})};
|
||||
m_texRedToAlphaZTestSub = {hecl::conv->convert(Shader_CElementGenShaderTexRedToAlphaZTestSub{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderTexRedToAlphaZTestSubAWrite{})};
|
||||
m_texRedToAlphaNoZTestSub = {hecl::conv->convert(Shader_CElementGenShaderTexRedToAlphaNoZTestSub{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderTexRedToAlphaNoZTestSubAWrite{})};
|
||||
|
||||
m_indTexZWrite = hecl::conv->convert(Shader_CElementGenShaderIndTexZWrite{});
|
||||
m_indTexNoZWrite = hecl::conv->convert(Shader_CElementGenShaderIndTexNoZWrite{});
|
||||
m_indTexAdditive = hecl::conv->convert(Shader_CElementGenShaderIndTexAdditive{});
|
||||
m_indTexZWrite = {hecl::conv->convert(Shader_CElementGenShaderIndTexZWrite{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderIndTexZWriteAWrite{})};
|
||||
m_indTexNoZWrite = {hecl::conv->convert(Shader_CElementGenShaderIndTexNoZWrite{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderIndTexNoZWriteAWrite{})};
|
||||
m_indTexAdditive = {hecl::conv->convert(Shader_CElementGenShaderIndTexAdditive{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderIndTexAdditiveAWrite{})};
|
||||
|
||||
m_cindTexZWrite = hecl::conv->convert(Shader_CElementGenShaderCindTexZWrite{});
|
||||
m_cindTexNoZWrite = hecl::conv->convert(Shader_CElementGenShaderCindTexNoZWrite{});
|
||||
m_cindTexAdditive = hecl::conv->convert(Shader_CElementGenShaderCindTexAdditive{});
|
||||
m_cindTexZWrite = {hecl::conv->convert(Shader_CElementGenShaderCindTexZWrite{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderCindTexZWriteAWrite{})};
|
||||
m_cindTexNoZWrite = {hecl::conv->convert(Shader_CElementGenShaderCindTexNoZWrite{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderCindTexNoZWriteAWrite{})};
|
||||
m_cindTexAdditive = {hecl::conv->convert(Shader_CElementGenShaderCindTexAdditive{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderCindTexAdditiveAWrite{})};
|
||||
|
||||
m_noTexZTestZWrite = hecl::conv->convert(Shader_CElementGenShaderNoTexZTestZWrite{});
|
||||
m_noTexNoZTestZWrite = hecl::conv->convert(Shader_CElementGenShaderNoTexNoZTestZWrite{});
|
||||
m_noTexZTestNoZWrite = hecl::conv->convert(Shader_CElementGenShaderNoTexZTestNoZWrite{});
|
||||
m_noTexNoZTestNoZWrite = hecl::conv->convert(Shader_CElementGenShaderNoTexNoZTestNoZWrite{});
|
||||
m_noTexAdditiveZTest = hecl::conv->convert(Shader_CElementGenShaderNoTexAdditiveZTest{});
|
||||
m_noTexAdditiveNoZTest = hecl::conv->convert(Shader_CElementGenShaderNoTexAdditiveNoZTest{});
|
||||
m_noTexZTestZWrite = {hecl::conv->convert(Shader_CElementGenShaderNoTexZTestZWrite{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderNoTexZTestZWriteAWrite{})};
|
||||
m_noTexNoZTestZWrite = {hecl::conv->convert(Shader_CElementGenShaderNoTexNoZTestZWrite{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderNoTexNoZTestZWriteAWrite{})};
|
||||
m_noTexZTestNoZWrite = {hecl::conv->convert(Shader_CElementGenShaderNoTexZTestNoZWrite{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderNoTexZTestNoZWriteAWrite{})};
|
||||
m_noTexNoZTestNoZWrite = {hecl::conv->convert(Shader_CElementGenShaderNoTexNoZTestNoZWrite{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderNoTexNoZTestNoZWriteAWrite{})};
|
||||
m_noTexAdditiveZTest = {hecl::conv->convert(Shader_CElementGenShaderNoTexAdditiveZTest{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderNoTexAdditiveZTestAWrite{})};
|
||||
m_noTexAdditiveNoZTest = {hecl::conv->convert(Shader_CElementGenShaderNoTexAdditiveNoZTest{}),
|
||||
hecl::conv->convert(Shader_CElementGenShaderNoTexAdditiveNoZTestAWrite{})};
|
||||
}
|
||||
|
||||
void CElementGenShaders::Shutdown() {
|
||||
m_texZTestZWrite.reset();
|
||||
m_texNoZTestZWrite.reset();
|
||||
m_texZTestNoZWrite.reset();
|
||||
m_texNoZTestNoZWrite.reset();
|
||||
m_texAdditiveZTest.reset();
|
||||
m_texAdditiveNoZTest.reset();
|
||||
m_texRedToAlphaZTest.reset();
|
||||
m_texRedToAlphaNoZTest.reset();
|
||||
m_texZTestNoZWriteSub.reset();
|
||||
m_texNoZTestNoZWriteSub.reset();
|
||||
m_texRedToAlphaZTestSub.reset();
|
||||
m_texRedToAlphaNoZTestSub.reset();
|
||||
for (auto& s : m_texZTestZWrite) s.reset();
|
||||
for (auto& s : m_texNoZTestZWrite) s.reset();
|
||||
for (auto& s : m_texZTestNoZWrite) s.reset();
|
||||
for (auto& s : m_texNoZTestNoZWrite) s.reset();
|
||||
for (auto& s : m_texAdditiveZTest) s.reset();
|
||||
for (auto& s : m_texAdditiveNoZTest) s.reset();
|
||||
for (auto& s : m_texRedToAlphaZTest) s.reset();
|
||||
for (auto& s : m_texRedToAlphaNoZTest) s.reset();
|
||||
for (auto& s : m_texZTestNoZWriteSub) s.reset();
|
||||
for (auto& s : m_texNoZTestNoZWriteSub) s.reset();
|
||||
for (auto& s : m_texRedToAlphaZTestSub) s.reset();
|
||||
for (auto& s : m_texRedToAlphaNoZTestSub) s.reset();
|
||||
|
||||
m_indTexZWrite.reset();
|
||||
m_indTexNoZWrite.reset();
|
||||
m_indTexAdditive.reset();
|
||||
for (auto& s : m_indTexZWrite) s.reset();
|
||||
for (auto& s : m_indTexNoZWrite) s.reset();
|
||||
for (auto& s : m_indTexAdditive) s.reset();
|
||||
|
||||
m_cindTexZWrite.reset();
|
||||
m_cindTexNoZWrite.reset();
|
||||
m_cindTexAdditive.reset();
|
||||
for (auto& s : m_cindTexZWrite) s.reset();
|
||||
for (auto& s : m_cindTexNoZWrite) s.reset();
|
||||
for (auto& s : m_cindTexAdditive) s.reset();
|
||||
|
||||
m_noTexZTestZWrite.reset();
|
||||
m_noTexNoZTestZWrite.reset();
|
||||
m_noTexZTestNoZWrite.reset();
|
||||
m_noTexNoZTestNoZWrite.reset();
|
||||
m_noTexAdditiveZTest.reset();
|
||||
m_noTexAdditiveNoZTest.reset();
|
||||
for (auto& s : m_noTexZTestZWrite) s.reset();
|
||||
for (auto& s : m_noTexNoZTestZWrite) s.reset();
|
||||
for (auto& s : m_noTexZTestNoZWrite) s.reset();
|
||||
for (auto& s : m_noTexNoZTestNoZWrite) s.reset();
|
||||
for (auto& s : m_noTexAdditiveZTest) s.reset();
|
||||
for (auto& s : m_noTexAdditiveNoZTest) s.reset();
|
||||
}
|
||||
|
||||
CElementGenShaders::EShaderClass CElementGenShaders::GetShaderClass(CElementGen& gen) {
|
||||
|
@ -106,97 +130,97 @@ CElementGenShaders::EShaderClass CElementGenShaders::GetShaderClass(CElementGen&
|
|||
|
||||
void CElementGenShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CElementGen& gen) {
|
||||
CGenDescription* desc = gen.x1c_genDesc.GetObj();
|
||||
boo::ObjToken<boo::IShaderPipeline> regPipeline;
|
||||
boo::ObjToken<boo::IShaderPipeline> regPipelineSub;
|
||||
boo::ObjToken<boo::IShaderPipeline> redToAlphaPipeline;
|
||||
boo::ObjToken<boo::IShaderPipeline> redToAlphaPipelineSub;
|
||||
boo::ObjToken<boo::IShaderPipeline> regPipelinePmus;
|
||||
boo::ObjToken<boo::IShaderPipeline> redToAlphaPipelinePmus;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2>* regPipeline = nullptr;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2>* regPipelineSub = nullptr;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2>* redToAlphaPipeline = nullptr;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2>* redToAlphaPipelineSub = nullptr;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2>* regPipelinePmus = nullptr;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2>* redToAlphaPipelinePmus = nullptr;
|
||||
|
||||
if (desc->x54_x40_TEXR) {
|
||||
if (desc->x58_x44_TIND) {
|
||||
if (desc->x45_30_x32_24_CIND) {
|
||||
if (gen.x26c_26_AAPH)
|
||||
regPipeline = m_cindTexAdditive;
|
||||
regPipeline = &m_cindTexAdditive;
|
||||
else {
|
||||
if (gen.x26c_27_ZBUF)
|
||||
regPipeline = m_cindTexZWrite;
|
||||
regPipeline = &m_cindTexZWrite;
|
||||
else
|
||||
regPipeline = m_cindTexNoZWrite;
|
||||
regPipeline = &m_cindTexNoZWrite;
|
||||
}
|
||||
} else {
|
||||
if (gen.x26c_26_AAPH)
|
||||
regPipeline = m_indTexAdditive;
|
||||
regPipeline = &m_indTexAdditive;
|
||||
else {
|
||||
if (gen.x26c_27_ZBUF)
|
||||
regPipeline = m_indTexZWrite;
|
||||
regPipeline = &m_indTexZWrite;
|
||||
else
|
||||
regPipeline = m_indTexNoZWrite;
|
||||
regPipeline = &m_indTexNoZWrite;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (gen.x26c_28_zTest) {
|
||||
redToAlphaPipeline = m_texRedToAlphaZTest;
|
||||
regPipelineSub = m_texZTestNoZWriteSub;
|
||||
redToAlphaPipelineSub = m_texRedToAlphaZTestSub;
|
||||
redToAlphaPipeline = &m_texRedToAlphaZTest;
|
||||
regPipelineSub = &m_texZTestNoZWriteSub;
|
||||
redToAlphaPipelineSub = &m_texRedToAlphaZTestSub;
|
||||
} else {
|
||||
redToAlphaPipeline = m_texRedToAlphaNoZTest;
|
||||
regPipelineSub = m_texNoZTestNoZWriteSub;
|
||||
redToAlphaPipelineSub = m_texRedToAlphaNoZTestSub;
|
||||
redToAlphaPipeline = &m_texRedToAlphaNoZTest;
|
||||
regPipelineSub = &m_texNoZTestNoZWriteSub;
|
||||
redToAlphaPipelineSub = &m_texRedToAlphaNoZTestSub;
|
||||
}
|
||||
|
||||
if (gen.x26c_26_AAPH) {
|
||||
if (gen.x26c_28_zTest)
|
||||
regPipeline = m_texAdditiveZTest;
|
||||
regPipeline = &m_texAdditiveZTest;
|
||||
else
|
||||
regPipeline = m_texAdditiveNoZTest;
|
||||
regPipeline = &m_texAdditiveNoZTest;
|
||||
} else {
|
||||
if (gen.x26c_28_zTest) {
|
||||
if (gen.x26c_27_ZBUF)
|
||||
regPipeline = m_texZTestZWrite;
|
||||
regPipeline = &m_texZTestZWrite;
|
||||
else
|
||||
regPipeline = m_texZTestNoZWrite;
|
||||
regPipeline = &m_texZTestNoZWrite;
|
||||
} else {
|
||||
if (gen.x26c_27_ZBUF)
|
||||
regPipeline = m_texNoZTestZWrite;
|
||||
regPipeline = &m_texNoZTestZWrite;
|
||||
else
|
||||
regPipeline = m_texNoZTestNoZWrite;
|
||||
regPipeline = &m_texNoZTestNoZWrite;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (gen.x26c_26_AAPH) {
|
||||
if (gen.x26c_28_zTest)
|
||||
regPipeline = m_noTexAdditiveZTest;
|
||||
regPipeline = &m_noTexAdditiveZTest;
|
||||
else
|
||||
regPipeline = m_noTexAdditiveNoZTest;
|
||||
regPipeline = &m_noTexAdditiveNoZTest;
|
||||
} else {
|
||||
if (gen.x26c_28_zTest) {
|
||||
if (gen.x26c_27_ZBUF)
|
||||
regPipeline = m_noTexZTestZWrite;
|
||||
regPipeline = &m_noTexZTestZWrite;
|
||||
else
|
||||
regPipeline = m_noTexZTestNoZWrite;
|
||||
regPipeline = &m_noTexZTestNoZWrite;
|
||||
} else {
|
||||
if (gen.x26c_27_ZBUF)
|
||||
regPipeline = m_noTexNoZTestZWrite;
|
||||
regPipeline = &m_noTexNoZTestZWrite;
|
||||
else
|
||||
regPipeline = m_noTexNoZTestNoZWrite;
|
||||
regPipeline = &m_noTexNoZTestNoZWrite;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (desc->x45_24_x31_26_PMUS) {
|
||||
if (desc->x54_x40_TEXR) {
|
||||
redToAlphaPipelinePmus = m_texRedToAlphaZTest;
|
||||
redToAlphaPipelinePmus = &m_texRedToAlphaZTest;
|
||||
if (desc->x44_31_x31_25_PMAB)
|
||||
regPipelinePmus = m_texAdditiveZTest;
|
||||
regPipelinePmus = &m_texAdditiveZTest;
|
||||
else
|
||||
regPipelinePmus = m_texZTestZWrite;
|
||||
regPipelinePmus = &m_texZTestZWrite;
|
||||
} else {
|
||||
if (desc->x44_31_x31_25_PMAB)
|
||||
regPipelinePmus = m_noTexAdditiveZTest;
|
||||
regPipelinePmus = &m_noTexAdditiveZTest;
|
||||
else
|
||||
regPipelinePmus = m_noTexZTestZWrite;
|
||||
regPipelinePmus = &m_noTexZTestZWrite;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,18 +245,24 @@ void CElementGenShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Conte
|
|||
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBuf.get()};
|
||||
|
||||
if (regPipeline)
|
||||
gen.m_normalDataBind = ctx.newShaderDataBinding(regPipeline, nullptr, gen.m_instBuf.get(), nullptr, 1, uniforms,
|
||||
nullptr, texCount, textures, nullptr, nullptr);
|
||||
for (int i = 0; i < 2; ++i)
|
||||
gen.m_normalDataBind[i] = ctx.newShaderDataBinding((*regPipeline)[i], nullptr, gen.m_instBuf.get(), nullptr, 1,
|
||||
uniforms, nullptr, texCount, textures, nullptr, nullptr);
|
||||
if (regPipelineSub)
|
||||
gen.m_normalSubDataBind = ctx.newShaderDataBinding(regPipelineSub, nullptr, gen.m_instBuf.get(), nullptr, 1,
|
||||
uniforms, nullptr, texCount, textures, nullptr, nullptr);
|
||||
for (int i = 0; i < 2; ++i)
|
||||
gen.m_normalSubDataBind[i] = ctx.newShaderDataBinding((*regPipelineSub)[i], nullptr, gen.m_instBuf.get(),
|
||||
nullptr, 1, uniforms, nullptr, texCount, textures,
|
||||
nullptr, nullptr);
|
||||
if (redToAlphaPipeline)
|
||||
gen.m_redToAlphaDataBind = ctx.newShaderDataBinding(redToAlphaPipeline, nullptr, gen.m_instBuf.get(), nullptr, 1,
|
||||
uniforms, nullptr, texCount, textures, nullptr, nullptr);
|
||||
for (int i = 0; i < 2; ++i)
|
||||
gen.m_redToAlphaDataBind[i] = ctx.newShaderDataBinding((*redToAlphaPipeline)[i], nullptr, gen.m_instBuf.get(),
|
||||
nullptr, 1, uniforms, nullptr, texCount, textures,
|
||||
nullptr, nullptr);
|
||||
if (redToAlphaPipelineSub)
|
||||
gen.m_redToAlphaSubDataBind =
|
||||
ctx.newShaderDataBinding(redToAlphaPipelineSub, nullptr, gen.m_instBuf.get(), nullptr, 1, uniforms, nullptr,
|
||||
texCount, textures, nullptr, nullptr);
|
||||
for (int i = 0; i < 2; ++i)
|
||||
gen.m_redToAlphaSubDataBind[i] =
|
||||
ctx.newShaderDataBinding((*redToAlphaPipelineSub)[i], nullptr, gen.m_instBuf.get(), nullptr, 1, uniforms,
|
||||
nullptr, texCount, textures, nullptr, nullptr);
|
||||
}
|
||||
|
||||
if (gen.m_instBufPmus) {
|
||||
|
@ -240,11 +270,14 @@ void CElementGenShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Conte
|
|||
texCount = std::min(texCount, 1);
|
||||
|
||||
if (regPipelinePmus)
|
||||
gen.m_normalDataBindPmus = ctx.newShaderDataBinding(regPipelinePmus, nullptr, gen.m_instBufPmus.get(), nullptr, 1,
|
||||
uniforms, nullptr, texCount, textures, nullptr, nullptr);
|
||||
for (int i = 0; i < 2; ++i)
|
||||
gen.m_normalDataBindPmus[i] = ctx.newShaderDataBinding((*regPipelinePmus)[i], nullptr, gen.m_instBufPmus.get(),
|
||||
nullptr, 1, uniforms, nullptr, texCount, textures,
|
||||
nullptr, nullptr);
|
||||
if (redToAlphaPipelinePmus)
|
||||
gen.m_redToAlphaDataBindPmus =
|
||||
ctx.newShaderDataBinding(redToAlphaPipelinePmus, nullptr, gen.m_instBufPmus.get(), nullptr, 1, uniforms,
|
||||
for (int i = 0; i < 2; ++i)
|
||||
gen.m_redToAlphaDataBindPmus[i] =
|
||||
ctx.newShaderDataBinding((*redToAlphaPipelinePmus)[i], nullptr, gen.m_instBufPmus.get(), nullptr, 1, uniforms,
|
||||
nullptr, texCount, textures, nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,33 +11,33 @@ public:
|
|||
enum class EShaderClass { Tex, IndTex, NoTex };
|
||||
|
||||
private:
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_texZTestZWrite;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_texNoZTestZWrite;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_texZTestNoZWrite;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_texNoZTestNoZWrite;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_texAdditiveZTest;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_texAdditiveNoZTest;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_texRedToAlphaZTest;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_texRedToAlphaNoZTest;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_texZTestNoZWriteSub;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_texNoZTestNoZWriteSub;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_texRedToAlphaZTestSub;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_texRedToAlphaNoZTestSub;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texZTestZWrite;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texNoZTestZWrite;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texZTestNoZWrite;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texNoZTestNoZWrite;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texAdditiveZTest;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texAdditiveNoZTest;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texRedToAlphaZTest;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texRedToAlphaNoZTest;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texZTestNoZWriteSub;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texNoZTestNoZWriteSub;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texRedToAlphaZTestSub;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texRedToAlphaNoZTestSub;
|
||||
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_indTexZWrite;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_indTexNoZWrite;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_indTexAdditive;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_indTexZWrite;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_indTexNoZWrite;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_indTexAdditive;
|
||||
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_cindTexZWrite;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_cindTexNoZWrite;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_cindTexAdditive;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_cindTexZWrite;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_cindTexNoZWrite;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_cindTexAdditive;
|
||||
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexZTestZWrite;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexNoZTestZWrite;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexZTestNoZWrite;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexNoZTestNoZWrite;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexAdditiveZTest;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexAdditiveNoZTest;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexZTestZWrite;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexNoZTestZWrite;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexZTestNoZWrite;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexNoZTestNoZWrite;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexAdditiveZTest;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexAdditiveNoZTest;
|
||||
|
||||
public:
|
||||
static void Initialize();
|
||||
|
|
|
@ -205,7 +205,7 @@ void CFluidPlaneShader::prepareDraw(const RenderSetupInfo& info) {
|
|||
for (int i = 0; i < 3; ++i)
|
||||
uni.m_lighting.colorRegs[i] = info.kColors[i];
|
||||
uni.m_lighting.mulColor = info.kColors[3];
|
||||
uni.m_lighting.fog.m_rangeScale = info.indScale;
|
||||
uni.m_pad2.x() = info.indScale;
|
||||
m_uniBuf->unmap();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,77 +4,86 @@
|
|||
|
||||
namespace urde {
|
||||
|
||||
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_texAlpha;
|
||||
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_texAdditive;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CLineRendererShaders::m_texAlpha;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CLineRendererShaders::m_texAdditive;
|
||||
|
||||
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_noTexAlpha;
|
||||
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_noTexAdditive;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CLineRendererShaders::m_noTexAlpha;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CLineRendererShaders::m_noTexAdditive;
|
||||
|
||||
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_texAlphaZ;
|
||||
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_texAdditiveZ;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CLineRendererShaders::m_texAlphaZ;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CLineRendererShaders::m_texAdditiveZ;
|
||||
|
||||
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_noTexAlphaZ;
|
||||
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_noTexAdditiveZ;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CLineRendererShaders::m_noTexAlphaZ;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CLineRendererShaders::m_noTexAdditiveZ;
|
||||
|
||||
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_noTexAlphaZGEqual;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CLineRendererShaders::m_noTexAlphaZGEqual;
|
||||
|
||||
void CLineRendererShaders::Initialize() {
|
||||
CGraphics::CommitResources([](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
m_texAlpha = hecl::conv->convert(ctx, Shader_CLineRendererShaderTexAlpha{});
|
||||
m_texAdditive = hecl::conv->convert(ctx, Shader_CLineRendererShaderTexAdditive{});
|
||||
m_noTexAlpha = hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAlpha{});
|
||||
m_noTexAdditive = hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAdditive{});
|
||||
m_texAlphaZ = hecl::conv->convert(ctx, Shader_CLineRendererShaderTexAlphaZ{});
|
||||
m_texAdditiveZ = hecl::conv->convert(ctx, Shader_CLineRendererShaderTexAdditiveZ{});
|
||||
m_noTexAlphaZ = hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAlphaZ{});
|
||||
m_noTexAdditiveZ = hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAdditiveZ{});
|
||||
m_noTexAlphaZGEqual = hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAlphaZGEqual{});
|
||||
m_texAlpha = {hecl::conv->convert(ctx, Shader_CLineRendererShaderTexAlpha{}),
|
||||
hecl::conv->convert(ctx, Shader_CLineRendererShaderTexAlphaAWrite{})};
|
||||
m_texAdditive = {hecl::conv->convert(ctx, Shader_CLineRendererShaderTexAdditive{}),
|
||||
hecl::conv->convert(ctx, Shader_CLineRendererShaderTexAdditiveAWrite{})};
|
||||
m_noTexAlpha = {hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAlpha{}),
|
||||
hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAlphaAWrite{})};
|
||||
m_noTexAdditive = {hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAdditive{}),
|
||||
hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAdditiveAWrite{})};
|
||||
m_texAlphaZ = {hecl::conv->convert(ctx, Shader_CLineRendererShaderTexAlphaZ{}),
|
||||
hecl::conv->convert(ctx, Shader_CLineRendererShaderTexAlphaZAWrite{})};
|
||||
m_texAdditiveZ = {hecl::conv->convert(ctx, Shader_CLineRendererShaderTexAdditiveZ{}),
|
||||
hecl::conv->convert(ctx, Shader_CLineRendererShaderTexAdditiveZAWrite{})};
|
||||
m_noTexAlphaZ = {hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAlphaZ{}),
|
||||
hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAlphaZAWrite{})};
|
||||
m_noTexAdditiveZ = {hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAdditiveZ{}),
|
||||
hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAdditiveZAWrite{})};
|
||||
m_noTexAlphaZGEqual = {hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAlphaZGEqual{}),
|
||||
hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAlphaZGEqualAWrite{})};
|
||||
return true;
|
||||
} BooTrace);
|
||||
}
|
||||
|
||||
void CLineRendererShaders::Shutdown() {
|
||||
m_texAlpha.reset();
|
||||
m_texAdditive.reset();
|
||||
m_noTexAlpha.reset();
|
||||
m_noTexAdditive.reset();
|
||||
m_texAlphaZ.reset();
|
||||
m_texAdditiveZ.reset();
|
||||
m_noTexAlphaZ.reset();
|
||||
m_noTexAdditiveZ.reset();
|
||||
m_noTexAlphaZGEqual.reset();
|
||||
for (auto& s : m_texAlpha) s.reset();
|
||||
for (auto& s : m_texAdditive) s.reset();
|
||||
for (auto& s : m_noTexAlpha) s.reset();
|
||||
for (auto& s : m_noTexAdditive) s.reset();
|
||||
for (auto& s : m_texAlphaZ) s.reset();
|
||||
for (auto& s : m_texAdditiveZ) s.reset();
|
||||
for (auto& s : m_noTexAlphaZ) s.reset();
|
||||
for (auto& s : m_noTexAdditiveZ) s.reset();
|
||||
for (auto& s : m_noTexAlphaZGEqual) s.reset();
|
||||
}
|
||||
|
||||
void CLineRendererShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CLineRenderer& renderer,
|
||||
const boo::ObjToken<boo::ITexture>& texture, bool additive,
|
||||
bool zTest, bool zGEqual) {
|
||||
boo::ObjToken<boo::IShaderPipeline> pipeline;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2>* pipeline = nullptr;
|
||||
|
||||
if (zGEqual) {
|
||||
pipeline = m_noTexAlphaZGEqual;
|
||||
pipeline = &m_noTexAlphaZGEqual;
|
||||
} else if (zTest) {
|
||||
if (texture) {
|
||||
if (additive)
|
||||
pipeline = m_texAdditiveZ;
|
||||
pipeline = &m_texAdditiveZ;
|
||||
else
|
||||
pipeline = m_texAlphaZ;
|
||||
pipeline = &m_texAlphaZ;
|
||||
} else {
|
||||
if (additive)
|
||||
pipeline = m_noTexAdditiveZ;
|
||||
pipeline = &m_noTexAdditiveZ;
|
||||
else
|
||||
pipeline = m_noTexAlphaZ;
|
||||
pipeline = &m_noTexAlphaZ;
|
||||
}
|
||||
} else {
|
||||
if (texture) {
|
||||
if (additive)
|
||||
pipeline = m_texAdditive;
|
||||
pipeline = &m_texAdditive;
|
||||
else
|
||||
pipeline = m_texAlpha;
|
||||
pipeline = &m_texAlpha;
|
||||
} else {
|
||||
if (additive)
|
||||
pipeline = m_noTexAdditive;
|
||||
pipeline = &m_noTexAdditive;
|
||||
else
|
||||
pipeline = m_noTexAlpha;
|
||||
pipeline = &m_noTexAlpha;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,12 +103,13 @@ void CLineRendererShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Con
|
|||
}
|
||||
|
||||
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {ubufInfo.first.get()};
|
||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||
boo::PipelineStage stages[] = {boo::PipelineStage::Fragment};
|
||||
size_t ubufOffs[] = {size_t(ubufInfo.second)};
|
||||
size_t ubufSizes[] = {sizeof(CLineRenderer::SDrawUniform)};
|
||||
|
||||
renderer.m_shaderBind =
|
||||
ctx.newShaderDataBinding(pipeline, vbufInfo.first.get(), nullptr, nullptr, 1, uniforms, stages, ubufOffs,
|
||||
for (int i = 0; i < 2; ++i)
|
||||
renderer.m_shaderBind[i] =
|
||||
ctx.newShaderDataBinding((*pipeline)[i], vbufInfo.first.get(), nullptr, nullptr, 1, uniforms, stages, ubufOffs,
|
||||
ubufSizes, texCount, textures, nullptr, nullptr, vbufInfo.second);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,19 +7,19 @@ namespace urde {
|
|||
class CLineRenderer;
|
||||
|
||||
class CLineRendererShaders {
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_texAlpha;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_texAdditive;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texAlpha;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texAdditive;
|
||||
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexAlpha;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexAdditive;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexAlpha;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexAdditive;
|
||||
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_texAlphaZ;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_texAdditiveZ;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texAlphaZ;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texAdditiveZ;
|
||||
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexAlphaZ;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexAdditiveZ;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexAlphaZ;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexAdditiveZ;
|
||||
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexAlphaZGEqual;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexAlphaZGEqual;
|
||||
|
||||
public:
|
||||
static void Initialize();
|
||||
|
|
|
@ -12,30 +12,31 @@ extern const hecl::Backend::Function ExtensionPostFuncsGLSL[];
|
|||
"{\n" \
|
||||
" int mode;\n" \
|
||||
" vec4 color;\n" \
|
||||
" float rangeScale;\n" \
|
||||
" float start;\n" \
|
||||
" float A;\n" \
|
||||
" float B;\n" \
|
||||
" float C;\n" \
|
||||
"};\n"
|
||||
|
||||
#define FOG_ALGORITHM_GLSL \
|
||||
" float fogZ, temp;\n" \
|
||||
" float fogZ;\n" \
|
||||
" float fogF = clamp((fog.A / (fog.B - gl_FragCoord.z)) - fog.C, 0.0, 1.0);\n" \
|
||||
" switch (fog.mode)\n" \
|
||||
" {\n" \
|
||||
" case 2:\n" \
|
||||
" fogZ = (-vtf.mvPos.z - fog.start) * fog.rangeScale;\n" \
|
||||
" fogZ = fogF;\n" \
|
||||
" break;\n" \
|
||||
" case 4:\n" \
|
||||
" fogZ = 1.0 - exp2(-8.0 * (-vtf.mvPos.z - fog.start) * fog.rangeScale);\n" \
|
||||
" fogZ = 1.0 - exp2(-8.0 * fogF);\n" \
|
||||
" break;\n" \
|
||||
" case 5:\n" \
|
||||
" temp = (-vtf.mvPos.z - fog.start) * fog.rangeScale;\n" \
|
||||
" fogZ = 1.0 - exp2(-8.0 * temp * temp);\n" \
|
||||
" fogZ = 1.0 - exp2(-8.0 * fogF * fogF);\n" \
|
||||
" break;\n" \
|
||||
" case 6:\n" \
|
||||
" fogZ = exp2(-8.0 * (fog.start + vtf.mvPos.z) * fog.rangeScale);\n" \
|
||||
" fogZ = exp2(-8.0 * (1.0 - fogF));\n" \
|
||||
" break;\n" \
|
||||
" case 7:\n" \
|
||||
" temp = (fog.start + vtf.mvPos.z) * fog.rangeScale;\n" \
|
||||
" fogZ = exp2(-8.0 * temp * temp);\n" \
|
||||
" fogF = 1.0 - fogF;\n" \
|
||||
" fogZ = exp2(-8.0 * fogF * fogF);\n" \
|
||||
" break;\n" \
|
||||
" default:\n" \
|
||||
" fogZ = 0.0;\n" \
|
||||
|
@ -101,13 +102,7 @@ static std::string_view LightingShadowGLSL =
|
|||
" vec4 linAtt;\n"
|
||||
" vec4 angAtt;\n"
|
||||
"};\n"
|
||||
"struct Fog\n"
|
||||
"{\n"
|
||||
" int mode;\n"
|
||||
" vec4 color;\n"
|
||||
" float rangeScale;\n"
|
||||
" float start;\n"
|
||||
"};\n"
|
||||
FOG_STRUCT_GLSL
|
||||
"\n"
|
||||
"UBINDING2 uniform LightingUniform\n"
|
||||
"{\n"
|
||||
|
|
|
@ -5,38 +5,46 @@
|
|||
|
||||
namespace urde {
|
||||
|
||||
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_texZWrite;
|
||||
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_texNoZWrite;
|
||||
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_texAdditiveZWrite;
|
||||
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_texAdditiveNoZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CParticleSwooshShaders::m_texZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CParticleSwooshShaders::m_texNoZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CParticleSwooshShaders::m_texAdditiveZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CParticleSwooshShaders::m_texAdditiveNoZWrite;
|
||||
|
||||
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_noTexZWrite;
|
||||
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_noTexNoZWrite;
|
||||
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_noTexAdditiveZWrite;
|
||||
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_noTexAdditiveNoZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CParticleSwooshShaders::m_noTexZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CParticleSwooshShaders::m_noTexNoZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CParticleSwooshShaders::m_noTexAdditiveZWrite;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CParticleSwooshShaders::m_noTexAdditiveNoZWrite;
|
||||
|
||||
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
|
||||
|
||||
void CParticleSwooshShaders::Initialize() {
|
||||
m_texZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderTexZWrite{});
|
||||
m_texNoZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderTexNoZWrite{});
|
||||
m_texAdditiveZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderTexAdditiveZWrite{});
|
||||
m_texAdditiveNoZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderTexAdditiveNoZWrite{});
|
||||
m_noTexZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderNoTexZWrite{});
|
||||
m_noTexNoZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderNoTexNoZWrite{});
|
||||
m_noTexAdditiveZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderNoTexAdditiveZWrite{});
|
||||
m_noTexAdditiveNoZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderNoTexAdditiveNoZWrite{});
|
||||
m_texZWrite = {hecl::conv->convert(Shader_CParticleSwooshShaderTexZWrite{}),
|
||||
hecl::conv->convert(Shader_CParticleSwooshShaderTexZWriteAWrite{})};
|
||||
m_texNoZWrite = {hecl::conv->convert(Shader_CParticleSwooshShaderTexNoZWrite{}),
|
||||
hecl::conv->convert(Shader_CParticleSwooshShaderTexNoZWriteAWrite{})};
|
||||
m_texAdditiveZWrite = {hecl::conv->convert(Shader_CParticleSwooshShaderTexAdditiveZWrite{}),
|
||||
hecl::conv->convert(Shader_CParticleSwooshShaderTexAdditiveZWriteAWrite{})};
|
||||
m_texAdditiveNoZWrite = {hecl::conv->convert(Shader_CParticleSwooshShaderTexAdditiveNoZWrite{}),
|
||||
hecl::conv->convert(Shader_CParticleSwooshShaderTexAdditiveNoZWriteAWrite{})};
|
||||
m_noTexZWrite = {hecl::conv->convert(Shader_CParticleSwooshShaderNoTexZWrite{}),
|
||||
hecl::conv->convert(Shader_CParticleSwooshShaderNoTexZWriteAWrite{})};
|
||||
m_noTexNoZWrite = {hecl::conv->convert(Shader_CParticleSwooshShaderNoTexNoZWrite{}),
|
||||
hecl::conv->convert(Shader_CParticleSwooshShaderNoTexNoZWriteAWrite{})};
|
||||
m_noTexAdditiveZWrite = {hecl::conv->convert(Shader_CParticleSwooshShaderNoTexAdditiveZWrite{}),
|
||||
hecl::conv->convert(Shader_CParticleSwooshShaderNoTexAdditiveZWriteAWrite{})};
|
||||
m_noTexAdditiveNoZWrite = {hecl::conv->convert(Shader_CParticleSwooshShaderNoTexAdditiveNoZWrite{}),
|
||||
hecl::conv->convert(Shader_CParticleSwooshShaderNoTexAdditiveNoZWriteAWrite{})};
|
||||
}
|
||||
|
||||
void CParticleSwooshShaders::Shutdown() {
|
||||
m_texZWrite.reset();
|
||||
m_texNoZWrite.reset();
|
||||
m_texAdditiveZWrite.reset();
|
||||
m_texAdditiveNoZWrite.reset();
|
||||
m_noTexZWrite.reset();
|
||||
m_noTexNoZWrite.reset();
|
||||
m_noTexAdditiveZWrite.reset();
|
||||
m_noTexAdditiveNoZWrite.reset();
|
||||
for (auto& s : m_texZWrite) s.reset();
|
||||
for (auto& s : m_texNoZWrite) s.reset();
|
||||
for (auto& s : m_texAdditiveZWrite) s.reset();
|
||||
for (auto& s : m_texAdditiveNoZWrite) s.reset();
|
||||
for (auto& s : m_noTexZWrite) s.reset();
|
||||
for (auto& s : m_noTexNoZWrite) s.reset();
|
||||
for (auto& s : m_noTexAdditiveZWrite) s.reset();
|
||||
for (auto& s : m_noTexAdditiveNoZWrite) s.reset();
|
||||
}
|
||||
|
||||
CParticleSwooshShaders::EShaderClass CParticleSwooshShaders::GetShaderClass(CParticleSwoosh& gen) {
|
||||
|
@ -50,31 +58,31 @@ CParticleSwooshShaders::EShaderClass CParticleSwooshShaders::GetShaderClass(CPar
|
|||
|
||||
void CParticleSwooshShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CParticleSwoosh& gen) {
|
||||
CSwooshDescription* desc = gen.GetDesc();
|
||||
boo::ObjToken<boo::IShaderPipeline> pipeline;
|
||||
std::array<boo::ObjToken<boo::IShaderPipeline>, 2>* pipeline = nullptr;
|
||||
|
||||
if (desc->x3c_TEXR) {
|
||||
if (desc->x44_31_AALP) {
|
||||
if (desc->x45_24_ZBUF)
|
||||
pipeline = m_texAdditiveZWrite;
|
||||
pipeline = &m_texAdditiveZWrite;
|
||||
else
|
||||
pipeline = m_texAdditiveNoZWrite;
|
||||
pipeline = &m_texAdditiveNoZWrite;
|
||||
} else {
|
||||
if (desc->x45_24_ZBUF)
|
||||
pipeline = m_texZWrite;
|
||||
pipeline = &m_texZWrite;
|
||||
else
|
||||
pipeline = m_texNoZWrite;
|
||||
pipeline = &m_texNoZWrite;
|
||||
}
|
||||
} else {
|
||||
if (desc->x44_31_AALP) {
|
||||
if (desc->x45_24_ZBUF)
|
||||
pipeline = m_noTexAdditiveZWrite;
|
||||
pipeline = &m_noTexAdditiveZWrite;
|
||||
else
|
||||
pipeline = m_noTexAdditiveNoZWrite;
|
||||
pipeline = &m_noTexAdditiveNoZWrite;
|
||||
} else {
|
||||
if (desc->x45_24_ZBUF)
|
||||
pipeline = m_noTexZWrite;
|
||||
pipeline = &m_noTexZWrite;
|
||||
else
|
||||
pipeline = m_noTexNoZWrite;
|
||||
pipeline = &m_noTexNoZWrite;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,8 +90,9 @@ void CParticleSwooshShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::C
|
|||
boo::ObjToken<boo::ITexture> textures[] = {texr ? texr->GetValueTexture(0).GetObj()->GetBooTexture() : nullptr};
|
||||
|
||||
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBuf.get()};
|
||||
gen.m_dataBind = ctx.newShaderDataBinding(pipeline, gen.m_vertBuf.get(), nullptr, nullptr, 1, uniforms, nullptr,
|
||||
texr ? 1 : 0, textures, nullptr, nullptr);
|
||||
for (int i = 0; i < 2; ++i)
|
||||
gen.m_dataBind[i] = ctx.newShaderDataBinding((*pipeline)[i], gen.m_vertBuf.get(), nullptr, nullptr, 1, uniforms,
|
||||
nullptr, texr ? 1 : 0, textures, nullptr, nullptr);
|
||||
}
|
||||
|
||||
} // namespace urde
|
||||
|
|
|
@ -17,15 +17,15 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_texZWrite;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_texNoZWrite;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_texAdditiveZWrite;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_texAdditiveNoZWrite;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texZWrite;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texNoZWrite;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texAdditiveZWrite;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texAdditiveNoZWrite;
|
||||
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexZWrite;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexNoZWrite;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexAdditiveZWrite;
|
||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexAdditiveNoZWrite;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexZWrite;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexNoZWrite;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexAdditiveZWrite;
|
||||
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexAdditiveNoZWrite;
|
||||
|
||||
public:
|
||||
static void Initialize();
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include "Graphics/Shaders/CElementGenShaders.hpp"
|
||||
#include "Character/CActorLights.hpp"
|
||||
#include "CWarp.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "Graphics/CBooRenderer.hpp"
|
||||
|
||||
#define MAX_GLOBAL_PARTICLES 2560
|
||||
|
||||
|
@ -881,9 +883,9 @@ void CElementGen::RenderModels(const CActorLights* actorLights) {
|
|||
m_uniformBufPmus->load(&uniformData, sizeof(SParticleUniforms));
|
||||
|
||||
if (moveRedToAlphaBuffer)
|
||||
CGraphics::SetShaderDataBinding(m_redToAlphaDataBindPmus);
|
||||
CGraphics::SetShaderDataBinding(m_redToAlphaDataBindPmus[g_Renderer->IsThermalVisorHotPass()]);
|
||||
else
|
||||
CGraphics::SetShaderDataBinding(m_normalDataBindPmus);
|
||||
CGraphics::SetShaderDataBinding(m_normalDataBindPmus[g_Renderer->IsThermalVisorHotPass()]);
|
||||
}
|
||||
|
||||
zeus::CTransform orient = zeus::CTransform();
|
||||
|
@ -1149,7 +1151,7 @@ void CElementGen::RenderLines() {
|
|||
}
|
||||
}
|
||||
|
||||
m_lineRenderer->Render(moduColor);
|
||||
m_lineRenderer->Render(g_Renderer->IsThermalVisorHotPass(), moduColor);
|
||||
}
|
||||
|
||||
void CElementGen::RenderParticles() {
|
||||
|
@ -1234,14 +1236,14 @@ void CElementGen::RenderParticles() {
|
|||
|
||||
if (g_subtractBlend) {
|
||||
if (moveRedToAlphaBuffer)
|
||||
CGraphics::SetShaderDataBinding(m_redToAlphaSubDataBind);
|
||||
CGraphics::SetShaderDataBinding(m_redToAlphaSubDataBind[g_Renderer->IsThermalVisorHotPass()]);
|
||||
else
|
||||
CGraphics::SetShaderDataBinding(m_normalSubDataBind);
|
||||
CGraphics::SetShaderDataBinding(m_normalSubDataBind[g_Renderer->IsThermalVisorHotPass()]);
|
||||
} else {
|
||||
if (moveRedToAlphaBuffer)
|
||||
CGraphics::SetShaderDataBinding(m_redToAlphaDataBind);
|
||||
CGraphics::SetShaderDataBinding(m_redToAlphaDataBind[g_Renderer->IsThermalVisorHotPass()]);
|
||||
else
|
||||
CGraphics::SetShaderDataBinding(m_normalDataBind);
|
||||
CGraphics::SetShaderDataBinding(m_normalDataBind[g_Renderer->IsThermalVisorHotPass()]);
|
||||
}
|
||||
|
||||