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 */
|
/* 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 */
|
/* Read and make RGBA */
|
||||||
for (int r = height - 1; r >= 0; --r) {
|
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 + 2] = rowBuf[inbase + 2];
|
||||||
bufOut[outbase + 3] = rowBuf[inbase + 3];
|
bufOut[outbase + 3] = rowBuf[inbase + 3];
|
||||||
if (rowBuf[inbase + 3] != 0 && rowBuf[inbase + 3] != 255)
|
if (rowBuf[inbase + 3] != 0 && rowBuf[inbase + 3] != 255)
|
||||||
doDXT1 = false;
|
doDXT = false;
|
||||||
|
else if (rowBuf[inbase + 3] == 0)
|
||||||
|
doDXT3 = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PNG_COLOR_TYPE_PALETTE:
|
case PNG_COLOR_TYPE_PALETTE:
|
||||||
|
@ -1521,7 +1524,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
|
||||||
unsigned filterWidth = width;
|
unsigned filterWidth = width;
|
||||||
unsigned filterHeight = height;
|
unsigned filterHeight = height;
|
||||||
for (size_t i = 1; i < numMips; ++i) {
|
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;
|
filterIn += filterWidth * filterHeight * nComps;
|
||||||
filterWidth /= 2;
|
filterWidth /= 2;
|
||||||
filterHeight /= 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;
|
std::unique_ptr<uint8_t[]> compOut;
|
||||||
size_t compLen = 0;
|
size_t compLen = 0;
|
||||||
if (doDXT1) {
|
if (doDXT) {
|
||||||
|
int compFlags = doDXT3 ? squish::kDxt3 : squish::kDxt1;
|
||||||
int filterWidth = width;
|
int filterWidth = width;
|
||||||
int filterHeight = height;
|
int filterHeight = height;
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < numMips; ++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) {
|
if (filterWidth == 4 || filterHeight == 4) {
|
||||||
++i;
|
++i;
|
||||||
break;
|
break;
|
||||||
|
@ -1554,8 +1558,8 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
|
||||||
const uint8_t* rgbaIn = bufOut.get();
|
const uint8_t* rgbaIn = bufOut.get();
|
||||||
uint8_t* blocksOut = compOut.get();
|
uint8_t* blocksOut = compOut.get();
|
||||||
for (i = 0; i < numMips; ++i) {
|
for (i = 0; i < numMips; ++i) {
|
||||||
int thisLen = squish::GetStorageRequirements(filterWidth, filterHeight, squish::kDxt1);
|
int thisLen = squish::GetStorageRequirements(filterWidth, filterHeight, compFlags);
|
||||||
squish::CompressImage(rgbaIn, filterWidth, filterHeight, blocksOut, squish::kDxt1);
|
squish::CompressImage(rgbaIn, filterWidth, filterHeight, blocksOut, compFlags);
|
||||||
rgbaIn += filterWidth * filterHeight * nComps;
|
rgbaIn += filterWidth * filterHeight * nComps;
|
||||||
blocksOut += thisLen;
|
blocksOut += thisLen;
|
||||||
filterWidth /= 2;
|
filterWidth /= 2;
|
||||||
|
@ -1574,7 +1578,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
|
||||||
if (paletteBuf && paletteSize)
|
if (paletteBuf && paletteSize)
|
||||||
format = 17;
|
format = 17;
|
||||||
else if (compOut)
|
else if (compOut)
|
||||||
format = 18;
|
format = doDXT3 ? 19 : 18;
|
||||||
else
|
else
|
||||||
format = 16;
|
format = 16;
|
||||||
outf.writeInt32Big(format);
|
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) {
|
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;
|
g_Fog.m_mode = mode > ERglFogMode::PerspRevExp2 ? ERglFogMode(int(mode) - 8) : mode;
|
||||||
switch (g_Fog.m_mode) {
|
g_Fog.m_color = color;
|
||||||
case ERglFogMode::None: {
|
if (CGraphics::g_Proj.x18_far == CGraphics::g_Proj.x14_near || endz == startz) {
|
||||||
g_Fog.m_start = 4096.f;
|
g_Fog.m_A = 0.f;
|
||||||
g_Fog.m_rangeScale = 0.f;
|
g_Fog.m_B = 0.5f;
|
||||||
break;
|
g_Fog.m_C = 0.f;
|
||||||
}
|
} else {
|
||||||
case ERglFogMode::PerspRevExp:
|
float depthrange = CGraphics::g_Proj.x18_far - CGraphics::g_Proj.x14_near;
|
||||||
case ERglFogMode::PerspRevExp2: {
|
float fogrange = endz - startz;
|
||||||
float userRange = endz - startz;
|
g_Fog.m_A = (CGraphics::g_Proj.x18_far * CGraphics::g_Proj.x14_near) / (depthrange * fogrange);
|
||||||
g_Fog.m_color = color;
|
g_Fog.m_B = CGraphics::g_Proj.x18_far / depthrange;
|
||||||
g_Fog.m_start = endz;
|
g_Fog.m_C = startz / fogrange;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,7 @@ enum class ETexelFormat {
|
||||||
RGBA8PC = 16,
|
RGBA8PC = 16,
|
||||||
C8PC = 17,
|
C8PC = 17,
|
||||||
CMPRPC = 18,
|
CMPRPC = 18,
|
||||||
|
CMPRPCA = 19,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEPTH_FAR 1.f
|
#define DEPTH_FAR 1.f
|
||||||
|
@ -191,8 +192,9 @@ public:
|
||||||
struct CFogState {
|
struct CFogState {
|
||||||
ERglFogMode m_mode;
|
ERglFogMode m_mode;
|
||||||
zeus::CColor m_color;
|
zeus::CColor m_color;
|
||||||
float m_rangeScale = 0.f;
|
float m_A = 0.f;
|
||||||
float m_start = 4096.f;
|
float m_B = 0.5f;
|
||||||
|
float m_C = 0.f;
|
||||||
};
|
};
|
||||||
|
|
||||||
static CProjectionState g_Proj;
|
static CProjectionState g_Proj;
|
||||||
|
|
|
@ -107,7 +107,7 @@ void CLineRenderer::Reset() {
|
||||||
|
|
||||||
void CLineRenderer::AddVertex(const zeus::CVector3f& position, const zeus::CColor& color, float width,
|
void CLineRenderer::AddVertex(const zeus::CVector3f& position, const zeus::CColor& color, float width,
|
||||||
const zeus::CVector2f& uv) {
|
const zeus::CVector2f& uv) {
|
||||||
if (m_final || !m_shaderBind || m_nextVert >= m_maxVerts)
|
if (m_final || !m_shaderBind[0] || m_nextVert >= m_maxVerts)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float adjWidth = width / 480.f;
|
float adjWidth = width / 480.f;
|
||||||
|
@ -237,7 +237,7 @@ void CLineRenderer::AddVertex(const zeus::CVector3f& position, const zeus::CColo
|
||||||
++m_nextVert;
|
++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_final && m_nextVert > 1) {
|
||||||
if (m_mode == EPrimitiveMode::LineLoop) {
|
if (m_mode == EPrimitiveMode::LineLoop) {
|
||||||
{
|
{
|
||||||
|
@ -366,18 +366,18 @@ void CLineRenderer::Render(const zeus::CColor& moduColor) {
|
||||||
m_final = true;
|
m_final = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_uniformBuf.access() = SDrawUniform{moduColor};
|
m_uniformBuf.access() = SDrawUniform{moduColor, CGraphics::g_Fog};
|
||||||
if (m_textured) {
|
if (m_textured) {
|
||||||
if (!g_StaticLineVertsTex.empty()) {
|
if (!g_StaticLineVertsTex.empty()) {
|
||||||
memmove(m_vertBufTex.access(), g_StaticLineVertsTex.data(), sizeof(SDrawVertTex) * g_StaticLineVertsTex.size());
|
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());
|
CGraphics::DrawArray(0, g_StaticLineVertsTex.size());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!g_StaticLineVertsNoTex.empty()) {
|
if (!g_StaticLineVertsNoTex.empty()) {
|
||||||
memmove(m_vertBufNoTex.access(), g_StaticLineVertsNoTex.data(),
|
memmove(m_vertBufNoTex.access(), g_StaticLineVertsNoTex.data(),
|
||||||
sizeof(SDrawVertNoTex) * g_StaticLineVertsNoTex.size());
|
sizeof(SDrawVertNoTex) * g_StaticLineVertsNoTex.size());
|
||||||
CGraphics::SetShaderDataBinding(m_shaderBind);
|
CGraphics::SetShaderDataBinding(m_shaderBind[alphaWrite]);
|
||||||
CGraphics::DrawArray(0, g_StaticLineVertsNoTex.size());
|
CGraphics::DrawArray(0, g_StaticLineVertsNoTex.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "boo/graphicsdev/IGraphicsDataFactory.hpp"
|
#include "boo/graphicsdev/IGraphicsDataFactory.hpp"
|
||||||
#include "hecl/VertexBufferPool.hpp"
|
#include "hecl/VertexBufferPool.hpp"
|
||||||
#include "hecl/UniformBufferPool.hpp"
|
#include "hecl/UniformBufferPool.hpp"
|
||||||
|
#include "Graphics/CGraphics.hpp"
|
||||||
|
|
||||||
namespace urde {
|
namespace urde {
|
||||||
|
|
||||||
|
@ -27,6 +28,7 @@ public:
|
||||||
|
|
||||||
struct SDrawUniform {
|
struct SDrawUniform {
|
||||||
zeus::CColor moduColor;
|
zeus::CColor moduColor;
|
||||||
|
CGraphics::CFogState fog;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -61,7 +63,7 @@ public:
|
||||||
hecl::VertexBufferPool<SDrawVertTex>::Token m_vertBufTex;
|
hecl::VertexBufferPool<SDrawVertTex>::Token m_vertBufTex;
|
||||||
hecl::VertexBufferPool<SDrawVertNoTex>::Token m_vertBufNoTex;
|
hecl::VertexBufferPool<SDrawVertNoTex>::Token m_vertBufNoTex;
|
||||||
hecl::UniformBufferPool<SDrawUniform>::Token m_uniformBuf;
|
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,
|
CLineRenderer(boo::IGraphicsDataFactory::Context& ctx, EPrimitiveMode mode, u32 maxVerts,
|
||||||
const boo::ObjToken<boo::ITexture>& texture, bool additive, bool zTest = false, bool zGEqual = false);
|
const boo::ObjToken<boo::ITexture>& texture, bool additive, bool zTest = false, bool zGEqual = false);
|
||||||
|
@ -72,7 +74,7 @@ public:
|
||||||
void Reset();
|
void Reset();
|
||||||
void AddVertex(const zeus::CVector3f& position, const zeus::CColor& color, float width,
|
void AddVertex(const zeus::CVector3f& position, const zeus::CColor& color, float width,
|
||||||
const zeus::CVector2f& uv = zeus::skZero2f);
|
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() {
|
static void UpdateBuffers() {
|
||||||
s_vertPoolTex.updateBuffers();
|
s_vertPoolTex.updateBuffers();
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include "CRainSplashGenerator.hpp"
|
#include "CRainSplashGenerator.hpp"
|
||||||
#include "CStateManager.hpp"
|
#include "CStateManager.hpp"
|
||||||
#include "World/CWorld.hpp"
|
#include "World/CWorld.hpp"
|
||||||
|
#include "GameGlobalObjects.hpp"
|
||||||
|
#include "Graphics/CBooRenderer.hpp"
|
||||||
|
|
||||||
namespace urde {
|
namespace urde {
|
||||||
|
|
||||||
|
@ -32,7 +34,7 @@ void CRainSplashGenerator::SSplashLine::Draw(float alpha, float dt, const zeus::
|
||||||
vt += delta;
|
vt += delta;
|
||||||
m_renderer.AddVertex(vec, zeus::CColor(1.f, vertAlpha), 1);
|
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 BuildC8(const void* data, size_t length);
|
||||||
void BuildC8Font(const void* data, EFontType ftype);
|
void BuildC8Font(const void* data, EFontType ftype);
|
||||||
void BuildDXT1(const void* data, size_t length);
|
void BuildDXT1(const void* data, size_t length);
|
||||||
|
void BuildDXT3(const void* data, size_t length);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CTexture(ETexelFormat, s16, s16, s32);
|
CTexture(ETexelFormat, s16, s16, s32);
|
||||||
|
|
|
@ -686,6 +686,15 @@ void CTexture::BuildDXT1(const void* data, size_t length) {
|
||||||
} BooTrace);
|
} 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) {
|
CTexture::CTexture(ETexelFormat fmt, s16 w, s16 h, s32 mips) : x0_fmt(fmt), x4_w(w), x6_h(h), x8_mips(mips) {
|
||||||
/*
|
/*
|
||||||
x64_ = sMangleMipmaps;
|
x64_ = sMangleMipmaps;
|
||||||
|
@ -746,6 +755,9 @@ CTexture::CTexture(std::unique_ptr<u8[]>&& in, u32 length, bool otex) {
|
||||||
case ETexelFormat::CMPRPC:
|
case ETexelFormat::CMPRPC:
|
||||||
BuildDXT1(owned.get() + 12, length - 12);
|
BuildDXT1(owned.get() + 12, length - 12);
|
||||||
break;
|
break;
|
||||||
|
case ETexelFormat::CMPRPCA:
|
||||||
|
BuildDXT3(owned.get() + 12, length - 12);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Log.report(logvisor::Fatal, "invalid texture type %d for boo", int(x0_fmt));
|
Log.report(logvisor::Fatal, "invalid texture type %d for boo", int(x0_fmt));
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,92 +4,116 @@
|
||||||
|
|
||||||
namespace urde {
|
namespace urde {
|
||||||
|
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texZTestZWrite;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texZTestZWrite;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texNoZTestZWrite;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texNoZTestZWrite;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texZTestNoZWrite;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texZTestNoZWrite;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texNoZTestNoZWrite;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texNoZTestNoZWrite;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texAdditiveZTest;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texAdditiveZTest;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texAdditiveNoZTest;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texAdditiveNoZTest;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texRedToAlphaZTest;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texRedToAlphaZTest;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texRedToAlphaNoZTest;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texRedToAlphaNoZTest;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texZTestNoZWriteSub;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texZTestNoZWriteSub;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texNoZTestNoZWriteSub;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texNoZTestNoZWriteSub;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texRedToAlphaZTestSub;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texRedToAlphaZTestSub;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_texRedToAlphaNoZTestSub;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texRedToAlphaNoZTestSub;
|
||||||
|
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_indTexZWrite;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_indTexZWrite;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_indTexNoZWrite;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_indTexNoZWrite;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_indTexAdditive;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_indTexAdditive;
|
||||||
|
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_cindTexZWrite;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_cindTexZWrite;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_cindTexNoZWrite;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_cindTexNoZWrite;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_cindTexAdditive;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_cindTexAdditive;
|
||||||
|
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_noTexZTestZWrite;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_noTexZTestZWrite;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_noTexNoZTestZWrite;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_noTexNoZTestZWrite;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_noTexZTestNoZWrite;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_noTexZTestNoZWrite;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_noTexNoZTestNoZWrite;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_noTexNoZTestNoZWrite;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_noTexAdditiveZTest;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_noTexAdditiveZTest;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CElementGenShaders::m_noTexAdditiveNoZTest;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_noTexAdditiveNoZTest;
|
||||||
|
|
||||||
void CElementGenShaders::Initialize() {
|
void CElementGenShaders::Initialize() {
|
||||||
m_texZTestZWrite = hecl::conv->convert(Shader_CElementGenShaderTexZTestZWrite{});
|
m_texZTestZWrite = {hecl::conv->convert(Shader_CElementGenShaderTexZTestZWrite{}),
|
||||||
m_texNoZTestZWrite = hecl::conv->convert(Shader_CElementGenShaderTexNoZTestZWrite{});
|
hecl::conv->convert(Shader_CElementGenShaderTexZTestZWrite{})};
|
||||||
m_texZTestNoZWrite = hecl::conv->convert(Shader_CElementGenShaderTexZTestNoZWrite{});
|
m_texNoZTestZWrite = {hecl::conv->convert(Shader_CElementGenShaderTexNoZTestZWrite{}),
|
||||||
m_texNoZTestNoZWrite = hecl::conv->convert(Shader_CElementGenShaderTexNoZTestNoZWrite{});
|
hecl::conv->convert(Shader_CElementGenShaderTexNoZTestZWriteAWrite{})};
|
||||||
m_texAdditiveZTest = hecl::conv->convert(Shader_CElementGenShaderTexAdditiveZTest{});
|
m_texZTestNoZWrite = {hecl::conv->convert(Shader_CElementGenShaderTexZTestNoZWrite{}),
|
||||||
m_texAdditiveNoZTest = hecl::conv->convert(Shader_CElementGenShaderTexAdditiveNoZTest{});
|
hecl::conv->convert(Shader_CElementGenShaderTexZTestNoZWriteAWrite{})};
|
||||||
m_texRedToAlphaZTest = hecl::conv->convert(Shader_CElementGenShaderTexRedToAlphaZTest{});
|
m_texNoZTestNoZWrite = {hecl::conv->convert(Shader_CElementGenShaderTexNoZTestNoZWrite{}),
|
||||||
m_texRedToAlphaNoZTest = hecl::conv->convert(Shader_CElementGenShaderTexRedToAlphaNoZTest{});
|
hecl::conv->convert(Shader_CElementGenShaderTexNoZTestNoZWriteAWrite{})};
|
||||||
m_texZTestNoZWriteSub = hecl::conv->convert(Shader_CElementGenShaderTexZTestNoZWriteSub{});
|
m_texAdditiveZTest = {hecl::conv->convert(Shader_CElementGenShaderTexAdditiveZTest{}),
|
||||||
m_texNoZTestNoZWriteSub = hecl::conv->convert(Shader_CElementGenShaderTexNoZTestNoZWriteSub{});
|
hecl::conv->convert(Shader_CElementGenShaderTexAdditiveZTestAWrite{})};
|
||||||
m_texRedToAlphaZTestSub = hecl::conv->convert(Shader_CElementGenShaderTexRedToAlphaZTestSub{});
|
m_texAdditiveNoZTest = {hecl::conv->convert(Shader_CElementGenShaderTexAdditiveNoZTest{}),
|
||||||
m_texRedToAlphaNoZTestSub = hecl::conv->convert(Shader_CElementGenShaderTexRedToAlphaNoZTestSub{});
|
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_indTexZWrite = {hecl::conv->convert(Shader_CElementGenShaderIndTexZWrite{}),
|
||||||
m_indTexNoZWrite = hecl::conv->convert(Shader_CElementGenShaderIndTexNoZWrite{});
|
hecl::conv->convert(Shader_CElementGenShaderIndTexZWriteAWrite{})};
|
||||||
m_indTexAdditive = hecl::conv->convert(Shader_CElementGenShaderIndTexAdditive{});
|
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_cindTexZWrite = {hecl::conv->convert(Shader_CElementGenShaderCindTexZWrite{}),
|
||||||
m_cindTexNoZWrite = hecl::conv->convert(Shader_CElementGenShaderCindTexNoZWrite{});
|
hecl::conv->convert(Shader_CElementGenShaderCindTexZWriteAWrite{})};
|
||||||
m_cindTexAdditive = hecl::conv->convert(Shader_CElementGenShaderCindTexAdditive{});
|
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_noTexZTestZWrite = {hecl::conv->convert(Shader_CElementGenShaderNoTexZTestZWrite{}),
|
||||||
m_noTexNoZTestZWrite = hecl::conv->convert(Shader_CElementGenShaderNoTexNoZTestZWrite{});
|
hecl::conv->convert(Shader_CElementGenShaderNoTexZTestZWriteAWrite{})};
|
||||||
m_noTexZTestNoZWrite = hecl::conv->convert(Shader_CElementGenShaderNoTexZTestNoZWrite{});
|
m_noTexNoZTestZWrite = {hecl::conv->convert(Shader_CElementGenShaderNoTexNoZTestZWrite{}),
|
||||||
m_noTexNoZTestNoZWrite = hecl::conv->convert(Shader_CElementGenShaderNoTexNoZTestNoZWrite{});
|
hecl::conv->convert(Shader_CElementGenShaderNoTexNoZTestZWriteAWrite{})};
|
||||||
m_noTexAdditiveZTest = hecl::conv->convert(Shader_CElementGenShaderNoTexAdditiveZTest{});
|
m_noTexZTestNoZWrite = {hecl::conv->convert(Shader_CElementGenShaderNoTexZTestNoZWrite{}),
|
||||||
m_noTexAdditiveNoZTest = hecl::conv->convert(Shader_CElementGenShaderNoTexAdditiveNoZTest{});
|
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() {
|
void CElementGenShaders::Shutdown() {
|
||||||
m_texZTestZWrite.reset();
|
for (auto& s : m_texZTestZWrite) s.reset();
|
||||||
m_texNoZTestZWrite.reset();
|
for (auto& s : m_texNoZTestZWrite) s.reset();
|
||||||
m_texZTestNoZWrite.reset();
|
for (auto& s : m_texZTestNoZWrite) s.reset();
|
||||||
m_texNoZTestNoZWrite.reset();
|
for (auto& s : m_texNoZTestNoZWrite) s.reset();
|
||||||
m_texAdditiveZTest.reset();
|
for (auto& s : m_texAdditiveZTest) s.reset();
|
||||||
m_texAdditiveNoZTest.reset();
|
for (auto& s : m_texAdditiveNoZTest) s.reset();
|
||||||
m_texRedToAlphaZTest.reset();
|
for (auto& s : m_texRedToAlphaZTest) s.reset();
|
||||||
m_texRedToAlphaNoZTest.reset();
|
for (auto& s : m_texRedToAlphaNoZTest) s.reset();
|
||||||
m_texZTestNoZWriteSub.reset();
|
for (auto& s : m_texZTestNoZWriteSub) s.reset();
|
||||||
m_texNoZTestNoZWriteSub.reset();
|
for (auto& s : m_texNoZTestNoZWriteSub) s.reset();
|
||||||
m_texRedToAlphaZTestSub.reset();
|
for (auto& s : m_texRedToAlphaZTestSub) s.reset();
|
||||||
m_texRedToAlphaNoZTestSub.reset();
|
for (auto& s : m_texRedToAlphaNoZTestSub) s.reset();
|
||||||
|
|
||||||
m_indTexZWrite.reset();
|
for (auto& s : m_indTexZWrite) s.reset();
|
||||||
m_indTexNoZWrite.reset();
|
for (auto& s : m_indTexNoZWrite) s.reset();
|
||||||
m_indTexAdditive.reset();
|
for (auto& s : m_indTexAdditive) s.reset();
|
||||||
|
|
||||||
m_cindTexZWrite.reset();
|
for (auto& s : m_cindTexZWrite) s.reset();
|
||||||
m_cindTexNoZWrite.reset();
|
for (auto& s : m_cindTexNoZWrite) s.reset();
|
||||||
m_cindTexAdditive.reset();
|
for (auto& s : m_cindTexAdditive) s.reset();
|
||||||
|
|
||||||
m_noTexZTestZWrite.reset();
|
for (auto& s : m_noTexZTestZWrite) s.reset();
|
||||||
m_noTexNoZTestZWrite.reset();
|
for (auto& s : m_noTexNoZTestZWrite) s.reset();
|
||||||
m_noTexZTestNoZWrite.reset();
|
for (auto& s : m_noTexZTestNoZWrite) s.reset();
|
||||||
m_noTexNoZTestNoZWrite.reset();
|
for (auto& s : m_noTexNoZTestNoZWrite) s.reset();
|
||||||
m_noTexAdditiveZTest.reset();
|
for (auto& s : m_noTexAdditiveZTest) s.reset();
|
||||||
m_noTexAdditiveNoZTest.reset();
|
for (auto& s : m_noTexAdditiveNoZTest) s.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
CElementGenShaders::EShaderClass CElementGenShaders::GetShaderClass(CElementGen& gen) {
|
CElementGenShaders::EShaderClass CElementGenShaders::GetShaderClass(CElementGen& gen) {
|
||||||
|
@ -106,97 +130,97 @@ CElementGenShaders::EShaderClass CElementGenShaders::GetShaderClass(CElementGen&
|
||||||
|
|
||||||
void CElementGenShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CElementGen& gen) {
|
void CElementGenShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CElementGen& gen) {
|
||||||
CGenDescription* desc = gen.x1c_genDesc.GetObj();
|
CGenDescription* desc = gen.x1c_genDesc.GetObj();
|
||||||
boo::ObjToken<boo::IShaderPipeline> regPipeline;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2>* regPipeline = nullptr;
|
||||||
boo::ObjToken<boo::IShaderPipeline> regPipelineSub;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2>* regPipelineSub = nullptr;
|
||||||
boo::ObjToken<boo::IShaderPipeline> redToAlphaPipeline;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2>* redToAlphaPipeline = nullptr;
|
||||||
boo::ObjToken<boo::IShaderPipeline> redToAlphaPipelineSub;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2>* redToAlphaPipelineSub = nullptr;
|
||||||
boo::ObjToken<boo::IShaderPipeline> regPipelinePmus;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2>* regPipelinePmus = nullptr;
|
||||||
boo::ObjToken<boo::IShaderPipeline> redToAlphaPipelinePmus;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2>* redToAlphaPipelinePmus = nullptr;
|
||||||
|
|
||||||
if (desc->x54_x40_TEXR) {
|
if (desc->x54_x40_TEXR) {
|
||||||
if (desc->x58_x44_TIND) {
|
if (desc->x58_x44_TIND) {
|
||||||
if (desc->x45_30_x32_24_CIND) {
|
if (desc->x45_30_x32_24_CIND) {
|
||||||
if (gen.x26c_26_AAPH)
|
if (gen.x26c_26_AAPH)
|
||||||
regPipeline = m_cindTexAdditive;
|
regPipeline = &m_cindTexAdditive;
|
||||||
else {
|
else {
|
||||||
if (gen.x26c_27_ZBUF)
|
if (gen.x26c_27_ZBUF)
|
||||||
regPipeline = m_cindTexZWrite;
|
regPipeline = &m_cindTexZWrite;
|
||||||
else
|
else
|
||||||
regPipeline = m_cindTexNoZWrite;
|
regPipeline = &m_cindTexNoZWrite;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (gen.x26c_26_AAPH)
|
if (gen.x26c_26_AAPH)
|
||||||
regPipeline = m_indTexAdditive;
|
regPipeline = &m_indTexAdditive;
|
||||||
else {
|
else {
|
||||||
if (gen.x26c_27_ZBUF)
|
if (gen.x26c_27_ZBUF)
|
||||||
regPipeline = m_indTexZWrite;
|
regPipeline = &m_indTexZWrite;
|
||||||
else
|
else
|
||||||
regPipeline = m_indTexNoZWrite;
|
regPipeline = &m_indTexNoZWrite;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (gen.x26c_28_zTest) {
|
if (gen.x26c_28_zTest) {
|
||||||
redToAlphaPipeline = m_texRedToAlphaZTest;
|
redToAlphaPipeline = &m_texRedToAlphaZTest;
|
||||||
regPipelineSub = m_texZTestNoZWriteSub;
|
regPipelineSub = &m_texZTestNoZWriteSub;
|
||||||
redToAlphaPipelineSub = m_texRedToAlphaZTestSub;
|
redToAlphaPipelineSub = &m_texRedToAlphaZTestSub;
|
||||||
} else {
|
} else {
|
||||||
redToAlphaPipeline = m_texRedToAlphaNoZTest;
|
redToAlphaPipeline = &m_texRedToAlphaNoZTest;
|
||||||
regPipelineSub = m_texNoZTestNoZWriteSub;
|
regPipelineSub = &m_texNoZTestNoZWriteSub;
|
||||||
redToAlphaPipelineSub = m_texRedToAlphaNoZTestSub;
|
redToAlphaPipelineSub = &m_texRedToAlphaNoZTestSub;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gen.x26c_26_AAPH) {
|
if (gen.x26c_26_AAPH) {
|
||||||
if (gen.x26c_28_zTest)
|
if (gen.x26c_28_zTest)
|
||||||
regPipeline = m_texAdditiveZTest;
|
regPipeline = &m_texAdditiveZTest;
|
||||||
else
|
else
|
||||||
regPipeline = m_texAdditiveNoZTest;
|
regPipeline = &m_texAdditiveNoZTest;
|
||||||
} else {
|
} else {
|
||||||
if (gen.x26c_28_zTest) {
|
if (gen.x26c_28_zTest) {
|
||||||
if (gen.x26c_27_ZBUF)
|
if (gen.x26c_27_ZBUF)
|
||||||
regPipeline = m_texZTestZWrite;
|
regPipeline = &m_texZTestZWrite;
|
||||||
else
|
else
|
||||||
regPipeline = m_texZTestNoZWrite;
|
regPipeline = &m_texZTestNoZWrite;
|
||||||
} else {
|
} else {
|
||||||
if (gen.x26c_27_ZBUF)
|
if (gen.x26c_27_ZBUF)
|
||||||
regPipeline = m_texNoZTestZWrite;
|
regPipeline = &m_texNoZTestZWrite;
|
||||||
else
|
else
|
||||||
regPipeline = m_texNoZTestNoZWrite;
|
regPipeline = &m_texNoZTestNoZWrite;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (gen.x26c_26_AAPH) {
|
if (gen.x26c_26_AAPH) {
|
||||||
if (gen.x26c_28_zTest)
|
if (gen.x26c_28_zTest)
|
||||||
regPipeline = m_noTexAdditiveZTest;
|
regPipeline = &m_noTexAdditiveZTest;
|
||||||
else
|
else
|
||||||
regPipeline = m_noTexAdditiveNoZTest;
|
regPipeline = &m_noTexAdditiveNoZTest;
|
||||||
} else {
|
} else {
|
||||||
if (gen.x26c_28_zTest) {
|
if (gen.x26c_28_zTest) {
|
||||||
if (gen.x26c_27_ZBUF)
|
if (gen.x26c_27_ZBUF)
|
||||||
regPipeline = m_noTexZTestZWrite;
|
regPipeline = &m_noTexZTestZWrite;
|
||||||
else
|
else
|
||||||
regPipeline = m_noTexZTestNoZWrite;
|
regPipeline = &m_noTexZTestNoZWrite;
|
||||||
} else {
|
} else {
|
||||||
if (gen.x26c_27_ZBUF)
|
if (gen.x26c_27_ZBUF)
|
||||||
regPipeline = m_noTexNoZTestZWrite;
|
regPipeline = &m_noTexNoZTestZWrite;
|
||||||
else
|
else
|
||||||
regPipeline = m_noTexNoZTestNoZWrite;
|
regPipeline = &m_noTexNoZTestNoZWrite;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desc->x45_24_x31_26_PMUS) {
|
if (desc->x45_24_x31_26_PMUS) {
|
||||||
if (desc->x54_x40_TEXR) {
|
if (desc->x54_x40_TEXR) {
|
||||||
redToAlphaPipelinePmus = m_texRedToAlphaZTest;
|
redToAlphaPipelinePmus = &m_texRedToAlphaZTest;
|
||||||
if (desc->x44_31_x31_25_PMAB)
|
if (desc->x44_31_x31_25_PMAB)
|
||||||
regPipelinePmus = m_texAdditiveZTest;
|
regPipelinePmus = &m_texAdditiveZTest;
|
||||||
else
|
else
|
||||||
regPipelinePmus = m_texZTestZWrite;
|
regPipelinePmus = &m_texZTestZWrite;
|
||||||
} else {
|
} else {
|
||||||
if (desc->x44_31_x31_25_PMAB)
|
if (desc->x44_31_x31_25_PMAB)
|
||||||
regPipelinePmus = m_noTexAdditiveZTest;
|
regPipelinePmus = &m_noTexAdditiveZTest;
|
||||||
else
|
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()};
|
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBuf.get()};
|
||||||
|
|
||||||
if (regPipeline)
|
if (regPipeline)
|
||||||
gen.m_normalDataBind = ctx.newShaderDataBinding(regPipeline, nullptr, gen.m_instBuf.get(), nullptr, 1, uniforms,
|
for (int i = 0; i < 2; ++i)
|
||||||
nullptr, texCount, textures, nullptr, nullptr);
|
gen.m_normalDataBind[i] = ctx.newShaderDataBinding((*regPipeline)[i], nullptr, gen.m_instBuf.get(), nullptr, 1,
|
||||||
|
uniforms, nullptr, texCount, textures, nullptr, nullptr);
|
||||||
if (regPipelineSub)
|
if (regPipelineSub)
|
||||||
gen.m_normalSubDataBind = ctx.newShaderDataBinding(regPipelineSub, nullptr, gen.m_instBuf.get(), nullptr, 1,
|
for (int i = 0; i < 2; ++i)
|
||||||
uniforms, nullptr, texCount, textures, nullptr, nullptr);
|
gen.m_normalSubDataBind[i] = ctx.newShaderDataBinding((*regPipelineSub)[i], nullptr, gen.m_instBuf.get(),
|
||||||
|
nullptr, 1, uniforms, nullptr, texCount, textures,
|
||||||
|
nullptr, nullptr);
|
||||||
if (redToAlphaPipeline)
|
if (redToAlphaPipeline)
|
||||||
gen.m_redToAlphaDataBind = ctx.newShaderDataBinding(redToAlphaPipeline, nullptr, gen.m_instBuf.get(), nullptr, 1,
|
for (int i = 0; i < 2; ++i)
|
||||||
uniforms, nullptr, texCount, textures, nullptr, nullptr);
|
gen.m_redToAlphaDataBind[i] = ctx.newShaderDataBinding((*redToAlphaPipeline)[i], nullptr, gen.m_instBuf.get(),
|
||||||
|
nullptr, 1, uniforms, nullptr, texCount, textures,
|
||||||
|
nullptr, nullptr);
|
||||||
if (redToAlphaPipelineSub)
|
if (redToAlphaPipelineSub)
|
||||||
gen.m_redToAlphaSubDataBind =
|
for (int i = 0; i < 2; ++i)
|
||||||
ctx.newShaderDataBinding(redToAlphaPipelineSub, nullptr, gen.m_instBuf.get(), nullptr, 1, uniforms, nullptr,
|
gen.m_redToAlphaSubDataBind[i] =
|
||||||
texCount, textures, nullptr, nullptr);
|
ctx.newShaderDataBinding((*redToAlphaPipelineSub)[i], nullptr, gen.m_instBuf.get(), nullptr, 1, uniforms,
|
||||||
|
nullptr, texCount, textures, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gen.m_instBufPmus) {
|
if (gen.m_instBufPmus) {
|
||||||
|
@ -240,11 +270,14 @@ void CElementGenShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Conte
|
||||||
texCount = std::min(texCount, 1);
|
texCount = std::min(texCount, 1);
|
||||||
|
|
||||||
if (regPipelinePmus)
|
if (regPipelinePmus)
|
||||||
gen.m_normalDataBindPmus = ctx.newShaderDataBinding(regPipelinePmus, nullptr, gen.m_instBufPmus.get(), nullptr, 1,
|
for (int i = 0; i < 2; ++i)
|
||||||
uniforms, nullptr, texCount, textures, nullptr, nullptr);
|
gen.m_normalDataBindPmus[i] = ctx.newShaderDataBinding((*regPipelinePmus)[i], nullptr, gen.m_instBufPmus.get(),
|
||||||
|
nullptr, 1, uniforms, nullptr, texCount, textures,
|
||||||
|
nullptr, nullptr);
|
||||||
if (redToAlphaPipelinePmus)
|
if (redToAlphaPipelinePmus)
|
||||||
gen.m_redToAlphaDataBindPmus =
|
for (int i = 0; i < 2; ++i)
|
||||||
ctx.newShaderDataBinding(redToAlphaPipelinePmus, nullptr, gen.m_instBufPmus.get(), nullptr, 1, uniforms,
|
gen.m_redToAlphaDataBindPmus[i] =
|
||||||
|
ctx.newShaderDataBinding((*redToAlphaPipelinePmus)[i], nullptr, gen.m_instBufPmus.get(), nullptr, 1, uniforms,
|
||||||
nullptr, texCount, textures, nullptr, nullptr);
|
nullptr, texCount, textures, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,33 +11,33 @@ public:
|
||||||
enum class EShaderClass { Tex, IndTex, NoTex };
|
enum class EShaderClass { Tex, IndTex, NoTex };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_texZTestZWrite;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texZTestZWrite;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_texNoZTestZWrite;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texNoZTestZWrite;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_texZTestNoZWrite;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texZTestNoZWrite;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_texNoZTestNoZWrite;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texNoZTestNoZWrite;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_texAdditiveZTest;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texAdditiveZTest;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_texAdditiveNoZTest;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texAdditiveNoZTest;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_texRedToAlphaZTest;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texRedToAlphaZTest;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_texRedToAlphaNoZTest;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texRedToAlphaNoZTest;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_texZTestNoZWriteSub;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texZTestNoZWriteSub;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_texNoZTestNoZWriteSub;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texNoZTestNoZWriteSub;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_texRedToAlphaZTestSub;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texRedToAlphaZTestSub;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_texRedToAlphaNoZTestSub;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texRedToAlphaNoZTestSub;
|
||||||
|
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_indTexZWrite;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_indTexZWrite;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_indTexNoZWrite;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_indTexNoZWrite;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_indTexAdditive;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_indTexAdditive;
|
||||||
|
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_cindTexZWrite;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_cindTexZWrite;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_cindTexNoZWrite;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_cindTexNoZWrite;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_cindTexAdditive;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_cindTexAdditive;
|
||||||
|
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexZTestZWrite;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexZTestZWrite;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexNoZTestZWrite;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexNoZTestZWrite;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexZTestNoZWrite;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexZTestNoZWrite;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexNoZTestNoZWrite;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexNoZTestNoZWrite;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexAdditiveZTest;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexAdditiveZTest;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexAdditiveNoZTest;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexAdditiveNoZTest;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
|
|
|
@ -205,7 +205,7 @@ void CFluidPlaneShader::prepareDraw(const RenderSetupInfo& info) {
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < 3; ++i)
|
||||||
uni.m_lighting.colorRegs[i] = info.kColors[i];
|
uni.m_lighting.colorRegs[i] = info.kColors[i];
|
||||||
uni.m_lighting.mulColor = info.kColors[3];
|
uni.m_lighting.mulColor = info.kColors[3];
|
||||||
uni.m_lighting.fog.m_rangeScale = info.indScale;
|
uni.m_pad2.x() = info.indScale;
|
||||||
m_uniBuf->unmap();
|
m_uniBuf->unmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,77 +4,86 @@
|
||||||
|
|
||||||
namespace urde {
|
namespace urde {
|
||||||
|
|
||||||
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_texAlpha;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CLineRendererShaders::m_texAlpha;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_texAdditive;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CLineRendererShaders::m_texAdditive;
|
||||||
|
|
||||||
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_noTexAlpha;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CLineRendererShaders::m_noTexAlpha;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_noTexAdditive;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CLineRendererShaders::m_noTexAdditive;
|
||||||
|
|
||||||
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_texAlphaZ;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CLineRendererShaders::m_texAlphaZ;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_texAdditiveZ;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CLineRendererShaders::m_texAdditiveZ;
|
||||||
|
|
||||||
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_noTexAlphaZ;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CLineRendererShaders::m_noTexAlphaZ;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_noTexAdditiveZ;
|
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() {
|
void CLineRendererShaders::Initialize() {
|
||||||
CGraphics::CommitResources([](boo::IGraphicsDataFactory::Context& ctx) {
|
CGraphics::CommitResources([](boo::IGraphicsDataFactory::Context& ctx) {
|
||||||
m_texAlpha = hecl::conv->convert(ctx, Shader_CLineRendererShaderTexAlpha{});
|
m_texAlpha = {hecl::conv->convert(ctx, Shader_CLineRendererShaderTexAlpha{}),
|
||||||
m_texAdditive = hecl::conv->convert(ctx, Shader_CLineRendererShaderTexAdditive{});
|
hecl::conv->convert(ctx, Shader_CLineRendererShaderTexAlphaAWrite{})};
|
||||||
m_noTexAlpha = hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAlpha{});
|
m_texAdditive = {hecl::conv->convert(ctx, Shader_CLineRendererShaderTexAdditive{}),
|
||||||
m_noTexAdditive = hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAdditive{});
|
hecl::conv->convert(ctx, Shader_CLineRendererShaderTexAdditiveAWrite{})};
|
||||||
m_texAlphaZ = hecl::conv->convert(ctx, Shader_CLineRendererShaderTexAlphaZ{});
|
m_noTexAlpha = {hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAlpha{}),
|
||||||
m_texAdditiveZ = hecl::conv->convert(ctx, Shader_CLineRendererShaderTexAdditiveZ{});
|
hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAlphaAWrite{})};
|
||||||
m_noTexAlphaZ = hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAlphaZ{});
|
m_noTexAdditive = {hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAdditive{}),
|
||||||
m_noTexAdditiveZ = hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAdditiveZ{});
|
hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAdditiveAWrite{})};
|
||||||
m_noTexAlphaZGEqual = hecl::conv->convert(ctx, Shader_CLineRendererShaderNoTexAlphaZGEqual{});
|
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;
|
return true;
|
||||||
} BooTrace);
|
} BooTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLineRendererShaders::Shutdown() {
|
void CLineRendererShaders::Shutdown() {
|
||||||
m_texAlpha.reset();
|
for (auto& s : m_texAlpha) s.reset();
|
||||||
m_texAdditive.reset();
|
for (auto& s : m_texAdditive) s.reset();
|
||||||
m_noTexAlpha.reset();
|
for (auto& s : m_noTexAlpha) s.reset();
|
||||||
m_noTexAdditive.reset();
|
for (auto& s : m_noTexAdditive) s.reset();
|
||||||
m_texAlphaZ.reset();
|
for (auto& s : m_texAlphaZ) s.reset();
|
||||||
m_texAdditiveZ.reset();
|
for (auto& s : m_texAdditiveZ) s.reset();
|
||||||
m_noTexAlphaZ.reset();
|
for (auto& s : m_noTexAlphaZ) s.reset();
|
||||||
m_noTexAdditiveZ.reset();
|
for (auto& s : m_noTexAdditiveZ) s.reset();
|
||||||
m_noTexAlphaZGEqual.reset();
|
for (auto& s : m_noTexAlphaZGEqual) s.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLineRendererShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CLineRenderer& renderer,
|
void CLineRendererShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CLineRenderer& renderer,
|
||||||
const boo::ObjToken<boo::ITexture>& texture, bool additive,
|
const boo::ObjToken<boo::ITexture>& texture, bool additive,
|
||||||
bool zTest, bool zGEqual) {
|
bool zTest, bool zGEqual) {
|
||||||
boo::ObjToken<boo::IShaderPipeline> pipeline;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2>* pipeline = nullptr;
|
||||||
|
|
||||||
if (zGEqual) {
|
if (zGEqual) {
|
||||||
pipeline = m_noTexAlphaZGEqual;
|
pipeline = &m_noTexAlphaZGEqual;
|
||||||
} else if (zTest) {
|
} else if (zTest) {
|
||||||
if (texture) {
|
if (texture) {
|
||||||
if (additive)
|
if (additive)
|
||||||
pipeline = m_texAdditiveZ;
|
pipeline = &m_texAdditiveZ;
|
||||||
else
|
else
|
||||||
pipeline = m_texAlphaZ;
|
pipeline = &m_texAlphaZ;
|
||||||
} else {
|
} else {
|
||||||
if (additive)
|
if (additive)
|
||||||
pipeline = m_noTexAdditiveZ;
|
pipeline = &m_noTexAdditiveZ;
|
||||||
else
|
else
|
||||||
pipeline = m_noTexAlphaZ;
|
pipeline = &m_noTexAlphaZ;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (texture) {
|
if (texture) {
|
||||||
if (additive)
|
if (additive)
|
||||||
pipeline = m_texAdditive;
|
pipeline = &m_texAdditive;
|
||||||
else
|
else
|
||||||
pipeline = m_texAlpha;
|
pipeline = &m_texAlpha;
|
||||||
} else {
|
} else {
|
||||||
if (additive)
|
if (additive)
|
||||||
pipeline = m_noTexAdditive;
|
pipeline = &m_noTexAdditive;
|
||||||
else
|
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::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 ubufOffs[] = {size_t(ubufInfo.second)};
|
||||||
size_t ubufSizes[] = {sizeof(CLineRenderer::SDrawUniform)};
|
size_t ubufSizes[] = {sizeof(CLineRenderer::SDrawUniform)};
|
||||||
|
|
||||||
renderer.m_shaderBind =
|
for (int i = 0; i < 2; ++i)
|
||||||
ctx.newShaderDataBinding(pipeline, vbufInfo.first.get(), nullptr, nullptr, 1, uniforms, stages, ubufOffs,
|
renderer.m_shaderBind[i] =
|
||||||
|
ctx.newShaderDataBinding((*pipeline)[i], vbufInfo.first.get(), nullptr, nullptr, 1, uniforms, stages, ubufOffs,
|
||||||
ubufSizes, texCount, textures, nullptr, nullptr, vbufInfo.second);
|
ubufSizes, texCount, textures, nullptr, nullptr, vbufInfo.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,19 +7,19 @@ namespace urde {
|
||||||
class CLineRenderer;
|
class CLineRenderer;
|
||||||
|
|
||||||
class CLineRendererShaders {
|
class CLineRendererShaders {
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_texAlpha;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texAlpha;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_texAdditive;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texAdditive;
|
||||||
|
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexAlpha;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexAlpha;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexAdditive;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexAdditive;
|
||||||
|
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_texAlphaZ;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texAlphaZ;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_texAdditiveZ;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texAdditiveZ;
|
||||||
|
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexAlphaZ;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexAlphaZ;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexAdditiveZ;
|
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:
|
public:
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
|
|
|
@ -12,30 +12,31 @@ extern const hecl::Backend::Function ExtensionPostFuncsGLSL[];
|
||||||
"{\n" \
|
"{\n" \
|
||||||
" int mode;\n" \
|
" int mode;\n" \
|
||||||
" vec4 color;\n" \
|
" vec4 color;\n" \
|
||||||
" float rangeScale;\n" \
|
" float A;\n" \
|
||||||
" float start;\n" \
|
" float B;\n" \
|
||||||
|
" float C;\n" \
|
||||||
"};\n"
|
"};\n"
|
||||||
|
|
||||||
#define FOG_ALGORITHM_GLSL \
|
#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" \
|
" switch (fog.mode)\n" \
|
||||||
" {\n" \
|
" {\n" \
|
||||||
" case 2:\n" \
|
" case 2:\n" \
|
||||||
" fogZ = (-vtf.mvPos.z - fog.start) * fog.rangeScale;\n" \
|
" fogZ = fogF;\n" \
|
||||||
" break;\n" \
|
" break;\n" \
|
||||||
" case 4:\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" \
|
" break;\n" \
|
||||||
" case 5:\n" \
|
" case 5:\n" \
|
||||||
" temp = (-vtf.mvPos.z - fog.start) * fog.rangeScale;\n" \
|
" fogZ = 1.0 - exp2(-8.0 * fogF * fogF);\n" \
|
||||||
" fogZ = 1.0 - exp2(-8.0 * temp * temp);\n" \
|
|
||||||
" break;\n" \
|
" break;\n" \
|
||||||
" case 6:\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" \
|
" break;\n" \
|
||||||
" case 7:\n" \
|
" case 7:\n" \
|
||||||
" temp = (fog.start + vtf.mvPos.z) * fog.rangeScale;\n" \
|
" fogF = 1.0 - fogF;\n" \
|
||||||
" fogZ = exp2(-8.0 * temp * temp);\n" \
|
" fogZ = exp2(-8.0 * fogF * fogF);\n" \
|
||||||
" break;\n" \
|
" break;\n" \
|
||||||
" default:\n" \
|
" default:\n" \
|
||||||
" fogZ = 0.0;\n" \
|
" fogZ = 0.0;\n" \
|
||||||
|
@ -101,13 +102,7 @@ static std::string_view LightingShadowGLSL =
|
||||||
" vec4 linAtt;\n"
|
" vec4 linAtt;\n"
|
||||||
" vec4 angAtt;\n"
|
" vec4 angAtt;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"struct Fog\n"
|
FOG_STRUCT_GLSL
|
||||||
"{\n"
|
|
||||||
" int mode;\n"
|
|
||||||
" vec4 color;\n"
|
|
||||||
" float rangeScale;\n"
|
|
||||||
" float start;\n"
|
|
||||||
"};\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
"UBINDING2 uniform LightingUniform\n"
|
"UBINDING2 uniform LightingUniform\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
|
@ -5,38 +5,46 @@
|
||||||
|
|
||||||
namespace urde {
|
namespace urde {
|
||||||
|
|
||||||
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_texZWrite;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CParticleSwooshShaders::m_texZWrite;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_texNoZWrite;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CParticleSwooshShaders::m_texNoZWrite;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_texAdditiveZWrite;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CParticleSwooshShaders::m_texAdditiveZWrite;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_texAdditiveNoZWrite;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CParticleSwooshShaders::m_texAdditiveNoZWrite;
|
||||||
|
|
||||||
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_noTexZWrite;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CParticleSwooshShaders::m_noTexZWrite;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_noTexNoZWrite;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CParticleSwooshShaders::m_noTexNoZWrite;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_noTexAdditiveZWrite;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CParticleSwooshShaders::m_noTexAdditiveZWrite;
|
||||||
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_noTexAdditiveNoZWrite;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CParticleSwooshShaders::m_noTexAdditiveNoZWrite;
|
||||||
|
|
||||||
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
|
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
|
||||||
|
|
||||||
void CParticleSwooshShaders::Initialize() {
|
void CParticleSwooshShaders::Initialize() {
|
||||||
m_texZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderTexZWrite{});
|
m_texZWrite = {hecl::conv->convert(Shader_CParticleSwooshShaderTexZWrite{}),
|
||||||
m_texNoZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderTexNoZWrite{});
|
hecl::conv->convert(Shader_CParticleSwooshShaderTexZWriteAWrite{})};
|
||||||
m_texAdditiveZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderTexAdditiveZWrite{});
|
m_texNoZWrite = {hecl::conv->convert(Shader_CParticleSwooshShaderTexNoZWrite{}),
|
||||||
m_texAdditiveNoZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderTexAdditiveNoZWrite{});
|
hecl::conv->convert(Shader_CParticleSwooshShaderTexNoZWriteAWrite{})};
|
||||||
m_noTexZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderNoTexZWrite{});
|
m_texAdditiveZWrite = {hecl::conv->convert(Shader_CParticleSwooshShaderTexAdditiveZWrite{}),
|
||||||
m_noTexNoZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderNoTexNoZWrite{});
|
hecl::conv->convert(Shader_CParticleSwooshShaderTexAdditiveZWriteAWrite{})};
|
||||||
m_noTexAdditiveZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderNoTexAdditiveZWrite{});
|
m_texAdditiveNoZWrite = {hecl::conv->convert(Shader_CParticleSwooshShaderTexAdditiveNoZWrite{}),
|
||||||
m_noTexAdditiveNoZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderNoTexAdditiveNoZWrite{});
|
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() {
|
void CParticleSwooshShaders::Shutdown() {
|
||||||
m_texZWrite.reset();
|
for (auto& s : m_texZWrite) s.reset();
|
||||||
m_texNoZWrite.reset();
|
for (auto& s : m_texNoZWrite) s.reset();
|
||||||
m_texAdditiveZWrite.reset();
|
for (auto& s : m_texAdditiveZWrite) s.reset();
|
||||||
m_texAdditiveNoZWrite.reset();
|
for (auto& s : m_texAdditiveNoZWrite) s.reset();
|
||||||
m_noTexZWrite.reset();
|
for (auto& s : m_noTexZWrite) s.reset();
|
||||||
m_noTexNoZWrite.reset();
|
for (auto& s : m_noTexNoZWrite) s.reset();
|
||||||
m_noTexAdditiveZWrite.reset();
|
for (auto& s : m_noTexAdditiveZWrite) s.reset();
|
||||||
m_noTexAdditiveNoZWrite.reset();
|
for (auto& s : m_noTexAdditiveNoZWrite) s.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
CParticleSwooshShaders::EShaderClass CParticleSwooshShaders::GetShaderClass(CParticleSwoosh& gen) {
|
CParticleSwooshShaders::EShaderClass CParticleSwooshShaders::GetShaderClass(CParticleSwoosh& gen) {
|
||||||
|
@ -50,31 +58,31 @@ CParticleSwooshShaders::EShaderClass CParticleSwooshShaders::GetShaderClass(CPar
|
||||||
|
|
||||||
void CParticleSwooshShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CParticleSwoosh& gen) {
|
void CParticleSwooshShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CParticleSwoosh& gen) {
|
||||||
CSwooshDescription* desc = gen.GetDesc();
|
CSwooshDescription* desc = gen.GetDesc();
|
||||||
boo::ObjToken<boo::IShaderPipeline> pipeline;
|
std::array<boo::ObjToken<boo::IShaderPipeline>, 2>* pipeline = nullptr;
|
||||||
|
|
||||||
if (desc->x3c_TEXR) {
|
if (desc->x3c_TEXR) {
|
||||||
if (desc->x44_31_AALP) {
|
if (desc->x44_31_AALP) {
|
||||||
if (desc->x45_24_ZBUF)
|
if (desc->x45_24_ZBUF)
|
||||||
pipeline = m_texAdditiveZWrite;
|
pipeline = &m_texAdditiveZWrite;
|
||||||
else
|
else
|
||||||
pipeline = m_texAdditiveNoZWrite;
|
pipeline = &m_texAdditiveNoZWrite;
|
||||||
} else {
|
} else {
|
||||||
if (desc->x45_24_ZBUF)
|
if (desc->x45_24_ZBUF)
|
||||||
pipeline = m_texZWrite;
|
pipeline = &m_texZWrite;
|
||||||
else
|
else
|
||||||
pipeline = m_texNoZWrite;
|
pipeline = &m_texNoZWrite;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (desc->x44_31_AALP) {
|
if (desc->x44_31_AALP) {
|
||||||
if (desc->x45_24_ZBUF)
|
if (desc->x45_24_ZBUF)
|
||||||
pipeline = m_noTexAdditiveZWrite;
|
pipeline = &m_noTexAdditiveZWrite;
|
||||||
else
|
else
|
||||||
pipeline = m_noTexAdditiveNoZWrite;
|
pipeline = &m_noTexAdditiveNoZWrite;
|
||||||
} else {
|
} else {
|
||||||
if (desc->x45_24_ZBUF)
|
if (desc->x45_24_ZBUF)
|
||||||
pipeline = m_noTexZWrite;
|
pipeline = &m_noTexZWrite;
|
||||||
else
|
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::ITexture> textures[] = {texr ? texr->GetValueTexture(0).GetObj()->GetBooTexture() : nullptr};
|
||||||
|
|
||||||
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBuf.get()};
|
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBuf.get()};
|
||||||
gen.m_dataBind = ctx.newShaderDataBinding(pipeline, gen.m_vertBuf.get(), nullptr, nullptr, 1, uniforms, nullptr,
|
for (int i = 0; i < 2; ++i)
|
||||||
texr ? 1 : 0, textures, nullptr, nullptr);
|
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
|
} // namespace urde
|
||||||
|
|
|
@ -17,15 +17,15 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_texZWrite;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texZWrite;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_texNoZWrite;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texNoZWrite;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_texAdditiveZWrite;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texAdditiveZWrite;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_texAdditiveNoZWrite;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texAdditiveNoZWrite;
|
||||||
|
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexZWrite;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexZWrite;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexNoZWrite;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexNoZWrite;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexAdditiveZWrite;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexAdditiveZWrite;
|
||||||
static boo::ObjToken<boo::IShaderPipeline> m_noTexAdditiveNoZWrite;
|
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexAdditiveNoZWrite;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include "Graphics/Shaders/CElementGenShaders.hpp"
|
#include "Graphics/Shaders/CElementGenShaders.hpp"
|
||||||
#include "Character/CActorLights.hpp"
|
#include "Character/CActorLights.hpp"
|
||||||
#include "CWarp.hpp"
|
#include "CWarp.hpp"
|
||||||
|
#include "GameGlobalObjects.hpp"
|
||||||
|
#include "Graphics/CBooRenderer.hpp"
|
||||||
|
|
||||||
#define MAX_GLOBAL_PARTICLES 2560
|
#define MAX_GLOBAL_PARTICLES 2560
|
||||||
|
|
||||||
|
@ -881,9 +883,9 @@ void CElementGen::RenderModels(const CActorLights* actorLights) {
|
||||||
m_uniformBufPmus->load(&uniformData, sizeof(SParticleUniforms));
|
m_uniformBufPmus->load(&uniformData, sizeof(SParticleUniforms));
|
||||||
|
|
||||||
if (moveRedToAlphaBuffer)
|
if (moveRedToAlphaBuffer)
|
||||||
CGraphics::SetShaderDataBinding(m_redToAlphaDataBindPmus);
|
CGraphics::SetShaderDataBinding(m_redToAlphaDataBindPmus[g_Renderer->IsThermalVisorHotPass()]);
|
||||||
else
|
else
|
||||||
CGraphics::SetShaderDataBinding(m_normalDataBindPmus);
|
CGraphics::SetShaderDataBinding(m_normalDataBindPmus[g_Renderer->IsThermalVisorHotPass()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
zeus::CTransform orient = zeus::CTransform();
|
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() {
|
void CElementGen::RenderParticles() {
|
||||||
|
@ -1234,14 +1236,14 @@ void CElementGen::RenderParticles() {
|
||||||
|
|
||||||
if (g_subtractBlend) {
|
if (g_subtractBlend) {
|
||||||
if (moveRedToAlphaBuffer)
|
if (moveRedToAlphaBuffer)
|
||||||
CGraphics::SetShaderDataBinding(m_redToAlphaSubDataBind);
|
CGraphics::SetShaderDataBinding(m_redToAlphaSubDataBind[g_Renderer->IsThermalVisorHotPass()]);
|
||||||
else
|
else
|
||||||
CGraphics::SetShaderDataBinding(m_normalSubDataBind);
|
CGraphics::SetShaderDataBinding(m_normalSubDataBind[g_Renderer->IsThermalVisorHotPass()]);
|
||||||
} else {
|
} else {
|
||||||
if (moveRedToAlphaBuffer)
|
if (moveRedToAlphaBuffer)
|
||||||
CGraphics::SetShaderDataBinding(m_redToAlphaDataBind);
|
CGraphics::SetShaderDataBinding(m_redToAlphaDataBind[g_Renderer->IsThermalVisorHotPass()]);
|
||||||
else
|
else
|
||||||
CGraphics::SetShaderDataBinding(m_normalDataBind);
|
CGraphics::SetShaderDataBinding(m_normalDataBind[g_Renderer->IsThermalVisorHotPass()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbspVal = std::max(1, x270_MBSP);
|
int mbspVal = std::max(1, x270_MBSP);
|
||||||
|
@ -1657,7 +1659,7 @@ void CElementGen::RenderParticlesIndirectTexture() {
|
||||||
g_instIndTexData.reserve(x30_particles.size());
|
g_instIndTexData.reserve(x30_particles.size());
|
||||||
|
|
||||||
if (!x30_particles.empty())
|
if (!x30_particles.empty())
|
||||||
CGraphics::SetShaderDataBinding(m_normalDataBind);
|
CGraphics::SetShaderDataBinding(m_normalDataBind[g_Renderer->IsThermalVisorHotPass()]);
|
||||||
|
|
||||||
for (int i = 0; i < x30_particles.size(); ++i) {
|
for (int i = 0; i < x30_particles.size(); ++i) {
|
||||||
int partIdx = desc->x44_28_x30_28_SORT ? sortItems[i].x0_partIdx : i;
|
int partIdx = desc->x44_28_x30_28_SORT ? sortItems[i].x0_partIdx : i;
|
||||||
|
|
|
@ -144,15 +144,15 @@ public:
|
||||||
EOptionalSystemFlags flags = EOptionalSystemFlags::One);
|
EOptionalSystemFlags flags = EOptionalSystemFlags::One);
|
||||||
~CElementGen();
|
~CElementGen();
|
||||||
|
|
||||||
boo::ObjToken<boo::IShaderDataBinding> m_normalDataBind;
|
boo::ObjToken<boo::IShaderDataBinding> m_normalDataBind[2];
|
||||||
boo::ObjToken<boo::IShaderDataBinding> m_normalSubDataBind;
|
boo::ObjToken<boo::IShaderDataBinding> m_normalSubDataBind[2];
|
||||||
boo::ObjToken<boo::IShaderDataBinding> m_redToAlphaDataBind;
|
boo::ObjToken<boo::IShaderDataBinding> m_redToAlphaDataBind[2];
|
||||||
boo::ObjToken<boo::IShaderDataBinding> m_redToAlphaSubDataBind;
|
boo::ObjToken<boo::IShaderDataBinding> m_redToAlphaSubDataBind[2];
|
||||||
boo::ObjToken<boo::IGraphicsBufferD> m_instBuf;
|
boo::ObjToken<boo::IGraphicsBufferD> m_instBuf;
|
||||||
boo::ObjToken<boo::IGraphicsBufferD> m_uniformBuf;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniformBuf;
|
||||||
|
|
||||||
boo::ObjToken<boo::IShaderDataBinding> m_normalDataBindPmus;
|
boo::ObjToken<boo::IShaderDataBinding> m_normalDataBindPmus[2];
|
||||||
boo::ObjToken<boo::IShaderDataBinding> m_redToAlphaDataBindPmus;
|
boo::ObjToken<boo::IShaderDataBinding> m_redToAlphaDataBindPmus[2];
|
||||||
boo::ObjToken<boo::IGraphicsBufferD> m_instBufPmus;
|
boo::ObjToken<boo::IGraphicsBufferD> m_instBufPmus;
|
||||||
boo::ObjToken<boo::IGraphicsBufferD> m_uniformBufPmus;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniformBufPmus;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include "CParticleGlobals.hpp"
|
#include "CParticleGlobals.hpp"
|
||||||
#include "zeus/CRelAngle.hpp"
|
#include "zeus/CRelAngle.hpp"
|
||||||
#include "zeus/CQuaternion.hpp"
|
#include "zeus/CQuaternion.hpp"
|
||||||
|
#include "GameGlobalObjects.hpp"
|
||||||
|
#include "Graphics/CBooRenderer.hpp"
|
||||||
|
|
||||||
namespace urde {
|
namespace urde {
|
||||||
|
|
||||||
|
@ -96,7 +98,7 @@ void CParticleElectric::DrawLineStrip(const std::vector<zeus::CVector3f>& verts,
|
||||||
renderer.Reset();
|
renderer.Reset();
|
||||||
for (const zeus::CVector3f& vert : verts)
|
for (const zeus::CVector3f& vert : verts)
|
||||||
renderer.AddVertex(vert, useColor, width);
|
renderer.AddVertex(vert, useColor, width);
|
||||||
renderer.Render();
|
renderer.Render(g_Renderer->IsThermalVisorHotPass());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CParticleElectric::RenderLines() {
|
void CParticleElectric::RenderLines() {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include "CParticleSwoosh.hpp"
|
#include "CParticleSwoosh.hpp"
|
||||||
#include "CSwooshDescription.hpp"
|
#include "CSwooshDescription.hpp"
|
||||||
#include "CParticleGlobals.hpp"
|
#include "CParticleGlobals.hpp"
|
||||||
|
#include "GameGlobalObjects.hpp"
|
||||||
|
#include "Graphics/CBooRenderer.hpp"
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
namespace urde {
|
namespace urde {
|
||||||
|
@ -441,7 +443,7 @@ void CParticleSwoosh::RenderNSidedSpline() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x1bc_prim == GX::LINES)
|
if (x1bc_prim == GX::LINES)
|
||||||
m_lineRenderer->Render();
|
m_lineRenderer->Render(g_Renderer->IsThermalVisorHotPass());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CParticleSwoosh::RenderNSidedNoSpline() { RenderNSidedSpline(); }
|
void CParticleSwoosh::RenderNSidedNoSpline() { RenderNSidedSpline(); }
|
||||||
|
@ -870,8 +872,8 @@ void CParticleSwoosh::Render(const CActorLights*) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_cachedVerts.clear();
|
m_cachedVerts.clear();
|
||||||
if (m_dataBind)
|
if (m_dataBind[0])
|
||||||
CGraphics::SetShaderDataBinding(m_dataBind);
|
CGraphics::SetShaderDataBinding(m_dataBind[g_Renderer->IsThermalVisorHotPass()]);
|
||||||
|
|
||||||
CParticleGlobals::SetParticleLifetime(x1b4_LENG);
|
CParticleGlobals::SetParticleLifetime(x1b4_LENG);
|
||||||
CGlobalRandom gr(x1c0_rand);
|
CGlobalRandom gr(x1c0_rand);
|
||||||
|
|
|
@ -100,7 +100,7 @@ class CParticleSwoosh : public CParticleGen {
|
||||||
float x208_maxRadius = 0.f;
|
float x208_maxRadius = 0.f;
|
||||||
zeus::CColor x20c_moduColor = zeus::skWhite;
|
zeus::CColor x20c_moduColor = zeus::skWhite;
|
||||||
|
|
||||||
boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBind[2];
|
||||||
boo::ObjToken<boo::IGraphicsBufferD> m_vertBuf;
|
boo::ObjToken<boo::IGraphicsBufferD> m_vertBuf;
|
||||||
boo::ObjToken<boo::IGraphicsBufferD> m_uniformBuf;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniformBuf;
|
||||||
std::unique_ptr<CLineRenderer> m_lineRenderer;
|
std::unique_ptr<CLineRenderer> m_lineRenderer;
|
||||||
|
|
|
@ -175,9 +175,9 @@ void CEnvFxManager::CalculateSnowForces(const CVectorFixed8_8& zVec,
|
||||||
|
|
||||||
void CEnvFxManager::BuildBlockObjectList(rstl::reserved_vector<TUniqueId, 1024>& list, CStateManager& mgr) {
|
void CEnvFxManager::BuildBlockObjectList(rstl::reserved_vector<TUniqueId, 1024>& list, CStateManager& mgr) {
|
||||||
for (CEntity* ent : mgr.GetAllObjectList()) {
|
for (CEntity* ent : mgr.GetAllObjectList()) {
|
||||||
if (TCastToPtr<CScriptTrigger> trig = ent) {
|
TCastToPtr<CScriptTrigger> trig = ent;
|
||||||
if ((trig->GetTriggerFlags() & ETriggerFlags::BlockEnvironmentalEffects) != ETriggerFlags::None)
|
if (trig && (trig->GetTriggerFlags() & ETriggerFlags::BlockEnvironmentalEffects) != ETriggerFlags::None) {
|
||||||
list.push_back(ent->GetUniqueId());
|
list.push_back(ent->GetUniqueId());
|
||||||
} else if (TCastToPtr<CScriptWater> water = ent) {
|
} else if (TCastToPtr<CScriptWater> water = ent) {
|
||||||
list.push_back(ent->GetUniqueId());
|
list.push_back(ent->GetUniqueId());
|
||||||
}
|
}
|
||||||
|
@ -406,7 +406,7 @@ void CEnvFxManagerGrid::RenderRainParticles(const zeus::CTransform& camXf) const
|
||||||
m_lineRenderer.AddVertex(pos0, zeus::skWhite, 1.f, {0.f, uvy0});
|
m_lineRenderer.AddVertex(pos0, zeus::skWhite, 1.f, {0.f, uvy0});
|
||||||
m_lineRenderer.AddVertex(pos1, zeus::skClear, 1.f, {0.f, uvy1});
|
m_lineRenderer.AddVertex(pos1, zeus::skClear, 1.f, {0.f, uvy1});
|
||||||
}
|
}
|
||||||
m_lineRenderer.Render(zeus::CColor(1.f, 0.15f));
|
m_lineRenderer.Render(g_Renderer->IsThermalVisorHotPass(), zeus::CColor(1.f, 0.15f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEnvFxManagerGrid::RenderUnderwaterParticles(const zeus::CTransform& camXf) const {
|
void CEnvFxManagerGrid::RenderUnderwaterParticles(const zeus::CTransform& camXf) const {
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#primitive tristrips
|
#primitive tristrips
|
||||||
#depthtest lequal
|
#depthtest lequal
|
||||||
#depthwrite true
|
#depthwrite true
|
||||||
|
#alphawrite false
|
||||||
#culling none
|
#culling none
|
||||||
|
|
||||||
#vertex glsl
|
#vertex glsl
|
||||||
|
@ -149,47 +150,79 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
|
||||||
return vtf.color * tex0.sample(samp, vtf.uv);
|
return vtf.color * tex0.sample(samp, vtf.uv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#shader CElementGenShaderTexZTestZWriteAWrite : CElementGenShaderTexZTestZWrite
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderTexNoZTestZWrite : CElementGenShaderTexZTestZWrite
|
#shader CElementGenShaderTexNoZTestZWrite : CElementGenShaderTexZTestZWrite
|
||||||
#depthtest none
|
#depthtest none
|
||||||
#depthwrite true
|
#depthwrite true
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CElementGenShaderTexNoZTestZWriteAWrite : CElementGenShaderTexNoZTestZWrite
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderTexZTestNoZWrite : CElementGenShaderTexZTestZWrite
|
#shader CElementGenShaderTexZTestNoZWrite : CElementGenShaderTexZTestZWrite
|
||||||
#depthtest lequal
|
#depthtest lequal
|
||||||
#depthwrite false
|
#depthwrite false
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CElementGenShaderTexZTestNoZWriteAWrite : CElementGenShaderTexZTestNoZWrite
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderTexNoZTestNoZWrite : CElementGenShaderTexZTestZWrite
|
#shader CElementGenShaderTexNoZTestNoZWrite : CElementGenShaderTexZTestZWrite
|
||||||
#depthtest none
|
#depthtest none
|
||||||
#depthwrite false
|
#depthwrite false
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CElementGenShaderTexNoZTestNoZWriteAWrite : CElementGenShaderTexNoZTestNoZWrite
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderTexAdditiveZTest : CElementGenShaderTexZTestZWrite
|
#shader CElementGenShaderTexAdditiveZTest : CElementGenShaderTexZTestZWrite
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac one
|
#dstfac one
|
||||||
#depthtest lequal
|
#depthtest lequal
|
||||||
#depthwrite false
|
#depthwrite false
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CElementGenShaderTexAdditiveZTestAWrite : CElementGenShaderTexAdditiveZTest
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderTexAdditiveNoZTest : CElementGenShaderTexZTestZWrite
|
#shader CElementGenShaderTexAdditiveNoZTest : CElementGenShaderTexZTestZWrite
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac one
|
#dstfac one
|
||||||
#depthtest none
|
#depthtest none
|
||||||
#depthwrite false
|
#depthwrite false
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CElementGenShaderTexAdditiveNoZTestAWrite : CElementGenShaderTexAdditiveNoZTest
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderTexZTestNoZWriteSub : CElementGenShaderTexZTestZWrite
|
#shader CElementGenShaderTexZTestNoZWriteSub : CElementGenShaderTexZTestZWrite
|
||||||
#srcfac subtract
|
#srcfac subtract
|
||||||
#dstfac subtract
|
#dstfac subtract
|
||||||
#depthtest lequal
|
#depthtest lequal
|
||||||
#depthwrite false
|
#depthwrite false
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CElementGenShaderTexZTestNoZWriteSubAWrite : CElementGenShaderTexZTestNoZWriteSub
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderTexNoZTestNoZWriteSub : CElementGenShaderTexZTestZWrite
|
#shader CElementGenShaderTexNoZTestNoZWriteSub : CElementGenShaderTexZTestZWrite
|
||||||
#srcfac subtract
|
#srcfac subtract
|
||||||
#dstfac subtract
|
#dstfac subtract
|
||||||
#depthtest none
|
#depthtest none
|
||||||
#depthwrite false
|
#depthwrite false
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CElementGenShaderTexNoZTestNoZWriteSubAWrite : CElementGenShaderTexNoZTestNoZWriteSub
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderTexRedToAlphaZTest : CElementGenShaderTexZTestZWrite
|
#shader CElementGenShaderTexRedToAlphaZTest : CElementGenShaderTexZTestZWrite
|
||||||
#srcfac srcalpha
|
#srcfac one
|
||||||
#dstfac invsrcalpha
|
#dstfac one
|
||||||
#depthtest lequal
|
#depthtest lequal
|
||||||
#depthwrite false
|
#depthwrite false
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
#fragment glsl
|
#fragment glsl
|
||||||
struct VertToFrag
|
struct VertToFrag
|
||||||
|
@ -203,8 +236,10 @@ layout(location=0) out vec4 colorOut;
|
||||||
TBINDING0 uniform sampler2D tex;
|
TBINDING0 uniform sampler2D tex;
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
colorOut = vtf.color;
|
vec4 texel = texture(tex, vtf.uv);
|
||||||
colorOut.a = texture(tex, vtf.uv).r;
|
vec4 tmp = texel * vtf.color;
|
||||||
|
colorOut = tmp * tmp.a;
|
||||||
|
colorOut.a = tmp.a * texel.r;
|
||||||
}
|
}
|
||||||
|
|
||||||
#fragment hlsl
|
#fragment hlsl
|
||||||
|
@ -219,7 +254,9 @@ struct VertToFrag
|
||||||
|
|
||||||
float4 main(in VertToFrag vtf) : SV_Target0
|
float4 main(in VertToFrag vtf) : SV_Target0
|
||||||
{
|
{
|
||||||
return float4(vtf.color.rgb, tex0.Sample(samp, vtf.uv).r);
|
float4 texel = tex0.Sample(samp, vtf.uv);
|
||||||
|
float4 tmp = texel * vtf.color;
|
||||||
|
return float4(tmp * tmp.a, tmp.a * texel.r);
|
||||||
}
|
}
|
||||||
|
|
||||||
#fragment metal
|
#fragment metal
|
||||||
|
@ -234,21 +271,38 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
|
||||||
sampler samp [[ sampler(0) ]],
|
sampler samp [[ sampler(0) ]],
|
||||||
texture2d<float> tex0 [[ texture(0) ]])
|
texture2d<float> tex0 [[ texture(0) ]])
|
||||||
{
|
{
|
||||||
return float4(vtf.color.rgb, tex0.sample(samp, vtf.uv).r);
|
float4 texel = tex0.sample(samp, vtf.uv);
|
||||||
|
float4 tmp = texel * vtf.color;
|
||||||
|
return float4(tmp * tmp.a, tmp.a * texel.r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#shader CElementGenShaderTexRedToAlphaZTestAWrite : CElementGenShaderTexRedToAlphaZTest
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderTexRedToAlphaNoZTest : CElementGenShaderTexRedToAlphaZTest
|
#shader CElementGenShaderTexRedToAlphaNoZTest : CElementGenShaderTexRedToAlphaZTest
|
||||||
#depthtest none
|
#depthtest none
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CElementGenShaderTexRedToAlphaNoZTestAWrite : CElementGenShaderTexRedToAlphaNoZTest
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderTexRedToAlphaZTestSub : CElementGenShaderTexRedToAlphaZTest
|
#shader CElementGenShaderTexRedToAlphaZTestSub : CElementGenShaderTexRedToAlphaZTest
|
||||||
#srcfac subtract
|
#srcfac subtract
|
||||||
#dstfac subtract
|
#dstfac subtract
|
||||||
#depthtest lequal
|
#depthtest lequal
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CElementGenShaderTexRedToAlphaZTestSubAWrite : CElementGenShaderTexRedToAlphaZTestSub
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderTexRedToAlphaNoZTestSub : CElementGenShaderTexRedToAlphaZTest
|
#shader CElementGenShaderTexRedToAlphaNoZTestSub : CElementGenShaderTexRedToAlphaZTest
|
||||||
#srcfac subtract
|
#srcfac subtract
|
||||||
#dstfac subtract
|
#dstfac subtract
|
||||||
#depthtest none
|
#depthtest none
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CElementGenShaderTexRedToAlphaNoZTestSubAWrite : CElementGenShaderTexRedToAlphaNoZTestSub
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderIndTexZWrite
|
#shader CElementGenShaderIndTexZWrite
|
||||||
#instattribute position4 0
|
#instattribute position4 0
|
||||||
|
@ -265,6 +319,7 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
|
||||||
#dstfac invsrcalpha
|
#dstfac invsrcalpha
|
||||||
#depthtest none
|
#depthtest none
|
||||||
#depthwrite true
|
#depthwrite true
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
#vertex glsl
|
#vertex glsl
|
||||||
layout(location=0) in vec4 posIn[4];
|
layout(location=0) in vec4 posIn[4];
|
||||||
|
@ -444,19 +499,31 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
|
||||||
return float4(colr.rgb, vtf.color.a * texrTexel.a);
|
return float4(colr.rgb, vtf.color.a * texrTexel.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#shader CElementGenShaderIndTexZWriteAWrite : CElementGenShaderIndTexZWrite
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderIndTexNoZWrite : CElementGenShaderIndTexZWrite
|
#shader CElementGenShaderIndTexNoZWrite : CElementGenShaderIndTexZWrite
|
||||||
#depthwrite false
|
#depthwrite false
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CElementGenShaderIndTexNoZWriteAWrite : CElementGenShaderIndTexNoZWrite
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderIndTexAdditive : CElementGenShaderIndTexZWrite
|
#shader CElementGenShaderIndTexAdditive : CElementGenShaderIndTexZWrite
|
||||||
#depthwrite true
|
#depthwrite true
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac one
|
#dstfac one
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CElementGenShaderIndTexAdditiveAWrite : CElementGenShaderIndTexAdditive
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderCindTexZWrite : CElementGenShaderIndTexZWrite
|
#shader CElementGenShaderCindTexZWrite : CElementGenShaderIndTexZWrite
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac invsrcalpha
|
#dstfac invsrcalpha
|
||||||
#depthtest none
|
#depthtest none
|
||||||
#depthwrite true
|
#depthwrite true
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
#fragment glsl
|
#fragment glsl
|
||||||
struct VertToFrag
|
struct VertToFrag
|
||||||
|
@ -521,13 +588,24 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
|
||||||
return vtf.color * float4(sceneTexel.rgb, 1.0) * tex0.sample(samp, vtf.uvTexr);
|
return vtf.color * float4(sceneTexel.rgb, 1.0) * tex0.sample(samp, vtf.uvTexr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#shader CElementGenShaderCindTexZWriteAWrite : CElementGenShaderCindTexZWrite
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderCindTexNoZWrite : CElementGenShaderCindTexZWrite
|
#shader CElementGenShaderCindTexNoZWrite : CElementGenShaderCindTexZWrite
|
||||||
#depthwrite false
|
#depthwrite false
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CElementGenShaderCindTexNoZWriteAWrite : CElementGenShaderCindTexNoZWrite
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderCindTexAdditive : CElementGenShaderCindTexZWrite
|
#shader CElementGenShaderCindTexAdditive : CElementGenShaderCindTexZWrite
|
||||||
#depthwrite true
|
#depthwrite true
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac one
|
#dstfac one
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CElementGenShaderCindTexAdditiveAWrite : CElementGenShaderCindTexAdditive
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderNoTexZTestZWrite
|
#shader CElementGenShaderNoTexZTestZWrite
|
||||||
#instattribute position4 0
|
#instattribute position4 0
|
||||||
|
@ -541,6 +619,7 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
|
||||||
#depthtest lequal
|
#depthtest lequal
|
||||||
#depthwrite true
|
#depthwrite true
|
||||||
#culling none
|
#culling none
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
#vertex glsl
|
#vertex glsl
|
||||||
layout(location=0) in vec4 posIn[4];
|
layout(location=0) in vec4 posIn[4];
|
||||||
|
@ -659,26 +738,49 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]])
|
||||||
return vtf.color;
|
return vtf.color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#shader CElementGenShaderNoTexZTestZWriteAWrite : CElementGenShaderNoTexZTestZWrite
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderNoTexNoZTestZWrite : CElementGenShaderNoTexZTestZWrite
|
#shader CElementGenShaderNoTexNoZTestZWrite : CElementGenShaderNoTexZTestZWrite
|
||||||
#depthtest none
|
#depthtest none
|
||||||
#depthwrite true
|
#depthwrite true
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CElementGenShaderNoTexNoZTestZWriteAWrite : CElementGenShaderNoTexNoZTestZWrite
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderNoTexZTestNoZWrite : CElementGenShaderNoTexZTestZWrite
|
#shader CElementGenShaderNoTexZTestNoZWrite : CElementGenShaderNoTexZTestZWrite
|
||||||
#depthtest lequal
|
#depthtest lequal
|
||||||
#depthwrite false
|
#depthwrite false
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CElementGenShaderNoTexZTestNoZWriteAWrite : CElementGenShaderNoTexZTestNoZWrite
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderNoTexNoZTestNoZWrite : CElementGenShaderNoTexZTestZWrite
|
#shader CElementGenShaderNoTexNoZTestNoZWrite : CElementGenShaderNoTexZTestZWrite
|
||||||
#depthtest none
|
#depthtest none
|
||||||
#depthwrite false
|
#depthwrite false
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CElementGenShaderNoTexNoZTestNoZWriteAWrite : CElementGenShaderNoTexNoZTestNoZWrite
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderNoTexAdditiveZTest : CElementGenShaderNoTexZTestZWrite
|
#shader CElementGenShaderNoTexAdditiveZTest : CElementGenShaderNoTexZTestZWrite
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac one
|
#dstfac one
|
||||||
#depthtest lequal
|
#depthtest lequal
|
||||||
#depthwrite false
|
#depthwrite false
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CElementGenShaderNoTexAdditiveZTestAWrite : CElementGenShaderNoTexAdditiveZTest
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CElementGenShaderNoTexAdditiveNoZTest : CElementGenShaderNoTexZTestZWrite
|
#shader CElementGenShaderNoTexAdditiveNoZTest : CElementGenShaderNoTexZTestZWrite
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac one
|
#dstfac one
|
||||||
#depthtest none
|
#depthtest none
|
||||||
#depthwrite false
|
#depthwrite false
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CElementGenShaderNoTexAdditiveNoZTestAWrite : CElementGenShaderNoTexAdditiveNoZTest
|
||||||
|
#alphawrite true
|
||||||
|
|
|
@ -66,37 +66,38 @@ UBINDING1 uniform FogUniform
|
||||||
{
|
{
|
||||||
int mode;
|
int mode;
|
||||||
vec4 color;
|
vec4 color;
|
||||||
float rangeScale;
|
float A;
|
||||||
float start;
|
float B;
|
||||||
|
float C;
|
||||||
};
|
};
|
||||||
|
|
||||||
vec4 MainPostFunc(vec4 colorIn)
|
vec4 MainPostFunc(vec4 colorIn)
|
||||||
{
|
{
|
||||||
float fogZ, temp;
|
float fogZ;
|
||||||
|
float fogF = clamp((A / (B - gl_FragCoord.z)) - C, 0.0, 1.0);
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
fogZ = (-vtf.mvPos.z - start) * rangeScale;
|
fogZ = fogF;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
fogZ = 1.0 - exp2(-8.0 * (-vtf.mvPos.z - start) * rangeScale);
|
fogZ = 1.0 - exp2(-8.0 * fogF);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
temp = (-vtf.mvPos.z - start) * rangeScale;
|
fogZ = 1.0 - exp2(-8.0 * fogF * fogF);
|
||||||
fogZ = 1.0 - exp2(-8.0 * temp * temp);
|
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
fogZ = exp2(-8.0 * (start + vtf.mvPos.z) * rangeScale);
|
fogZ = exp2(-8.0 * (1.0 - fogF));
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
temp = (start + vtf.mvPos.z) * rangeScale;
|
fogF = 1.0 - fogF;
|
||||||
fogZ = exp2(-8.0 * temp * temp);
|
fogZ = exp2(-8.0 * fogF * fogF);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fogZ = 0.0;
|
fogZ = 0.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return vec4(mix(colorIn, color, clamp(fogZ, 0.0, 1.0)).rgb, colorIn.a);
|
return vec4(mix(colorIn, vec4(0.0), clamp(fogZ, 0.0, 1.0)).rgb, colorIn.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
|
@ -159,37 +160,38 @@ cbuffer FogUniform : register(b1)
|
||||||
{
|
{
|
||||||
int mode;
|
int mode;
|
||||||
float4 color;
|
float4 color;
|
||||||
float rangeScale;
|
float A;
|
||||||
float start;
|
float B;
|
||||||
|
float C;
|
||||||
};
|
};
|
||||||
|
|
||||||
static float4 MainPostFunc(in VertToFrag vtf, float4 colorIn)
|
static float4 MainPostFunc(in VertToFrag vtf, float4 colorIn)
|
||||||
{
|
{
|
||||||
float fogZ, temp;
|
float fogZ;
|
||||||
|
float fogF = saturate((A / (B - vtf.position.z)) - C);
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
fogZ = (-vtf.mvPos.z - start) * rangeScale;
|
fogZ = fogF;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
fogZ = 1.0 - exp2(-8.0 * (-vtf.mvPos.z - start) * rangeScale);
|
fogZ = 1.0 - exp2(-8.0 * fogF);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
temp = (-vtf.mvPos.z - start) * rangeScale;
|
fogZ = 1.0 - exp2(-8.0 * fogF * fogF);
|
||||||
fogZ = 1.0 - exp2(-8.0 * temp * temp);
|
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
fogZ = exp2(-8.0 * (start + vtf.mvPos.z) * rangeScale);
|
fogZ = exp2(-8.0 * (1.0 - fogF));
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
temp = (start + vtf.mvPos.z) * rangeScale;
|
fogF = 1.0 - fogF;
|
||||||
fogZ = exp2(-8.0 * temp * temp);
|
fogZ = exp2(-8.0 * fogF * fogF);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fogZ = 0.0;
|
fogZ = 0.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return float4(lerp(colorIn, color, saturate(fogZ)).rgb, colorIn.a);
|
return float4(lerp(colorIn, float4(0.0,0.0,0.0,0.0), saturate(fogZ)).rgb, colorIn.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
float4 main(in VertToFrag vtf) : SV_Target0
|
float4 main(in VertToFrag vtf) : SV_Target0
|
||||||
|
@ -251,37 +253,38 @@ struct FogUniform
|
||||||
{
|
{
|
||||||
int mode;
|
int mode;
|
||||||
float4 color;
|
float4 color;
|
||||||
float rangeScale;
|
float A;
|
||||||
float start;
|
float B;
|
||||||
|
float C;
|
||||||
};
|
};
|
||||||
|
|
||||||
float4 MainPostFunc(thread VertToFrag& vtf, constant FogUniform& fu, float4 colorIn)
|
float4 MainPostFunc(thread VertToFrag& vtf, constant FogUniform& fu, float4 colorIn)
|
||||||
{
|
{
|
||||||
float fogZ, temp;
|
float fogZ;
|
||||||
|
float fogF = saturate((fu.A / (fu.B - vtf.position.z)) - fu.C);
|
||||||
switch (fu.mode)
|
switch (fu.mode)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
fogZ = (-vtf.mvPos.z - fu.start) * fu.rangeScale;
|
fogZ = fogF;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
fogZ = 1.0 - exp2(-8.0 * (-vtf.mvPos.z - fu.start) * fu.rangeScale);
|
fogZ = 1.0 - exp2(-8.0 * fogF);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
temp = (-vtf.mvPos.z - fu.start) * fu.rangeScale;
|
fogZ = 1.0 - exp2(-8.0 * fogF * fogF);
|
||||||
fogZ = 1.0 - exp2(-8.0 * temp * temp);
|
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
fogZ = exp2(-8.0 * (fu.start + vtf.mvPos.z) * fu.rangeScale);
|
fogZ = exp2(-8.0 * (1.0 - fogF));
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
temp = (fu.start + vtf.mvPos.z) * fu.rangeScale;
|
fogF = 1.0 - fogF;
|
||||||
fogZ = exp2(-8.0 * temp * temp);
|
fogZ = exp2(-8.0 * fogF * fogF);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fogZ = 0.0;
|
fogZ = 0.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return float4(mix(colorIn, fu.color, saturate(fogZ)).rgb, colorIn.a);
|
return float4(mix(colorIn, float4(0.0), saturate(fogZ)).rgb, colorIn.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
|
fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#primitive tristrips
|
#primitive tristrips
|
||||||
#depthtest none
|
#depthtest none
|
||||||
#depthwrite false
|
#depthwrite false
|
||||||
|
#alphawrite false
|
||||||
#culling none
|
#culling none
|
||||||
|
|
||||||
#vertex glsl
|
#vertex glsl
|
||||||
|
@ -14,11 +15,6 @@ layout(location=0) in vec4 posIn;
|
||||||
layout(location=1) in vec4 colorIn;
|
layout(location=1) in vec4 colorIn;
|
||||||
layout(location=2) in vec4 uvIn;
|
layout(location=2) in vec4 uvIn;
|
||||||
|
|
||||||
UBINDING0 uniform LineUniform
|
|
||||||
{
|
|
||||||
vec4 moduColor;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct VertToFrag
|
struct VertToFrag
|
||||||
{
|
{
|
||||||
vec4 color;
|
vec4 color;
|
||||||
|
@ -28,24 +24,68 @@ struct VertToFrag
|
||||||
SBINDING(0) out VertToFrag vtf;
|
SBINDING(0) out VertToFrag vtf;
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vtf.color = colorIn * moduColor;
|
vtf.color = colorIn;
|
||||||
vtf.uv = uvIn.xy;
|
vtf.uv = uvIn.xy;
|
||||||
gl_Position = posIn;
|
gl_Position = posIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
#fragment glsl
|
#fragment glsl
|
||||||
|
struct Fog
|
||||||
|
{
|
||||||
|
int mode;
|
||||||
|
vec4 color;
|
||||||
|
float A;
|
||||||
|
float B;
|
||||||
|
float C;
|
||||||
|
};
|
||||||
|
|
||||||
|
UBINDING0 uniform LineUniform
|
||||||
|
{
|
||||||
|
vec4 moduColor;
|
||||||
|
Fog fog;
|
||||||
|
};
|
||||||
|
|
||||||
struct VertToFrag
|
struct VertToFrag
|
||||||
{
|
{
|
||||||
vec4 color;
|
vec4 color;
|
||||||
vec2 uv;
|
vec2 uv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
vec4 MainPostFunc(vec4 colorIn)
|
||||||
|
{
|
||||||
|
float fogZ;
|
||||||
|
float fogF = clamp((fog.A / (fog.B - gl_FragCoord.z)) - fog.C, 0.0, 1.0);
|
||||||
|
switch (fog.mode)
|
||||||
|
{
|
||||||
|
case 2:
|
||||||
|
fogZ = fogF;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
fogZ = 1.0 - exp2(-8.0 * fogF);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
fogZ = 1.0 - exp2(-8.0 * fogF * fogF);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
fogZ = exp2(-8.0 * (1.0 - fogF));
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
fogF = 1.0 - fogF;
|
||||||
|
fogZ = exp2(-8.0 * fogF * fogF);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fogZ = 0.0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return vec4(mix(colorIn, vec4(0.0), clamp(fogZ, 0.0, 1.0)).rgb, colorIn.a);
|
||||||
|
}
|
||||||
|
|
||||||
SBINDING(0) in VertToFrag vtf;
|
SBINDING(0) in VertToFrag vtf;
|
||||||
layout(location=0) out vec4 colorOut;
|
layout(location=0) out vec4 colorOut;
|
||||||
TBINDING0 uniform sampler2D tex;
|
TBINDING0 uniform sampler2D tex;
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
colorOut = vtf.color * texture(tex, vtf.uv);
|
colorOut = MainPostFunc(vtf.color * moduColor * texture(tex, vtf.uv));
|
||||||
}
|
}
|
||||||
|
|
||||||
#vertex hlsl
|
#vertex hlsl
|
||||||
|
@ -139,20 +179,35 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
|
||||||
return vtf.color * tex0.sample(samp, vtf.uv);
|
return vtf.color * tex0.sample(samp, vtf.uv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#shader CLineRendererShaderTexAlphaAWrite : CLineRendererShaderTexAlpha
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CLineRendererShaderTexAdditive : CLineRendererShaderTexAlpha
|
#shader CLineRendererShaderTexAdditive : CLineRendererShaderTexAlpha
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac one
|
#dstfac one
|
||||||
#depthtest none
|
#depthtest none
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CLineRendererShaderTexAdditiveAWrite : CLineRendererShaderTexAdditive
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CLineRendererShaderTexAlphaZ : CLineRendererShaderTexAlpha
|
#shader CLineRendererShaderTexAlphaZ : CLineRendererShaderTexAlpha
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac invsrcalpha
|
#dstfac invsrcalpha
|
||||||
#depthtest lequal
|
#depthtest lequal
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CLineRendererShaderTexAlphaZAWrite : CLineRendererShaderTexAlphaZ
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CLineRendererShaderTexAdditiveZ : CLineRendererShaderTexAlpha
|
#shader CLineRendererShaderTexAdditiveZ : CLineRendererShaderTexAlpha
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac one
|
#dstfac one
|
||||||
#depthtest lequal
|
#depthtest lequal
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CLineRendererShaderTexAdditiveZAWrite : CLineRendererShaderTexAdditiveZ
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CLineRendererShaderNoTexAlpha
|
#shader CLineRendererShaderNoTexAlpha
|
||||||
#attribute position4
|
#attribute position4
|
||||||
|
@ -162,17 +217,13 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
|
||||||
#primitive tristrips
|
#primitive tristrips
|
||||||
#depthtest none
|
#depthtest none
|
||||||
#depthwrite false
|
#depthwrite false
|
||||||
|
#alphawrite false
|
||||||
#culling none
|
#culling none
|
||||||
|
|
||||||
#vertex glsl
|
#vertex glsl
|
||||||
layout(location=0) in vec4 posIn;
|
layout(location=0) in vec4 posIn;
|
||||||
layout(location=1) in vec4 colorIn;
|
layout(location=1) in vec4 colorIn;
|
||||||
|
|
||||||
UBINDING0 uniform LineUniform
|
|
||||||
{
|
|
||||||
vec4 moduColor;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct VertToFrag
|
struct VertToFrag
|
||||||
{
|
{
|
||||||
vec4 color;
|
vec4 color;
|
||||||
|
@ -181,21 +232,65 @@ struct VertToFrag
|
||||||
SBINDING(0) out VertToFrag vtf;
|
SBINDING(0) out VertToFrag vtf;
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vtf.color = colorIn * moduColor;
|
vtf.color = colorIn;
|
||||||
gl_Position = posIn;
|
gl_Position = posIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
#fragment glsl
|
#fragment glsl
|
||||||
|
struct Fog
|
||||||
|
{
|
||||||
|
int mode;
|
||||||
|
vec4 color;
|
||||||
|
float A;
|
||||||
|
float B;
|
||||||
|
float C;
|
||||||
|
};
|
||||||
|
|
||||||
|
UBINDING0 uniform LineUniform
|
||||||
|
{
|
||||||
|
vec4 moduColor;
|
||||||
|
Fog fog;
|
||||||
|
};
|
||||||
|
|
||||||
struct VertToFrag
|
struct VertToFrag
|
||||||
{
|
{
|
||||||
vec4 color;
|
vec4 color;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
vec4 MainPostFunc(vec4 colorIn)
|
||||||
|
{
|
||||||
|
float fogZ;
|
||||||
|
float fogF = clamp((fog.A / (fog.B - gl_FragCoord.z)) - fog.C, 0.0, 1.0);
|
||||||
|
switch (fog.mode)
|
||||||
|
{
|
||||||
|
case 2:
|
||||||
|
fogZ = fogF;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
fogZ = 1.0 - exp2(-8.0 * fogF);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
fogZ = 1.0 - exp2(-8.0 * fogF * fogF);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
fogZ = exp2(-8.0 * (1.0 - fogF));
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
fogF = 1.0 - fogF;
|
||||||
|
fogZ = exp2(-8.0 * fogF * fogF);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fogZ = 0.0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return vec4(mix(colorIn, vec4(0.0), clamp(fogZ, 0.0, 1.0)).rgb, colorIn.a);
|
||||||
|
}
|
||||||
|
|
||||||
SBINDING(0) in VertToFrag vtf;
|
SBINDING(0) in VertToFrag vtf;
|
||||||
layout(location=0) out vec4 colorOut;
|
layout(location=0) out vec4 colorOut;
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
colorOut = vtf.color;
|
colorOut = MainPostFunc(vtf.color * moduColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
#vertex hlsl
|
#vertex hlsl
|
||||||
|
@ -205,11 +300,6 @@ struct VertData
|
||||||
float4 colorIn : COLOR;
|
float4 colorIn : COLOR;
|
||||||
};
|
};
|
||||||
|
|
||||||
cbuffer LineUniform : register(b0)
|
|
||||||
{
|
|
||||||
float4 moduColor;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct VertToFrag
|
struct VertToFrag
|
||||||
{
|
{
|
||||||
float4 position : SV_Position;
|
float4 position : SV_Position;
|
||||||
|
@ -219,21 +309,65 @@ struct VertToFrag
|
||||||
VertToFrag main(in VertData v)
|
VertToFrag main(in VertData v)
|
||||||
{
|
{
|
||||||
VertToFrag vtf;
|
VertToFrag vtf;
|
||||||
vtf.color = v.colorIn * moduColor;
|
vtf.color = v.colorIn;
|
||||||
vtf.position = v.posIn;
|
vtf.position = v.posIn;
|
||||||
return vtf;
|
return vtf;
|
||||||
}
|
}
|
||||||
|
|
||||||
#fragment hlsl
|
#fragment hlsl
|
||||||
|
struct Fog
|
||||||
|
{
|
||||||
|
int mode;
|
||||||
|
float4 color;
|
||||||
|
float A;
|
||||||
|
float B;
|
||||||
|
float C;
|
||||||
|
};
|
||||||
|
|
||||||
|
cbuffer LineUniform : register(b0)
|
||||||
|
{
|
||||||
|
float4 moduColor;
|
||||||
|
Fog fog;
|
||||||
|
};
|
||||||
|
|
||||||
struct VertToFrag
|
struct VertToFrag
|
||||||
{
|
{
|
||||||
float4 position : SV_Position;
|
float4 position : SV_Position;
|
||||||
float4 color : COLOR;
|
float4 color : COLOR;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static float4 MainPostFunc(float4 colorIn, float4 FragCoord)
|
||||||
|
{
|
||||||
|
float fogZ;
|
||||||
|
float fogF = saturate((fog.A / (fog.B - FragCoord.z)) - fog.C);
|
||||||
|
switch (fog.mode)
|
||||||
|
{
|
||||||
|
case 2:
|
||||||
|
fogZ = fogF;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
fogZ = 1.0 - exp2(-8.0 * fogF);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
fogZ = 1.0 - exp2(-8.0 * fogF * fogF);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
fogZ = exp2(-8.0 * (1.0 - fogF));
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
fogF = 1.0 - fogF;
|
||||||
|
fogZ = exp2(-8.0 * fogF * fogF);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fogZ = 0.0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return float4(lerp(colorIn, float4(0.0,0.0,0.0,0.0), saturate(fogZ)).rgb, colorIn.a);
|
||||||
|
}
|
||||||
|
|
||||||
float4 main(in VertToFrag vtf) : SV_Target0
|
float4 main(in VertToFrag vtf) : SV_Target0
|
||||||
{
|
{
|
||||||
return vtf.color;
|
return MainPostFunc(vtf.color * moduColor, vtf.position);
|
||||||
}
|
}
|
||||||
|
|
||||||
#vertex metal
|
#vertex metal
|
||||||
|
@ -243,11 +377,6 @@ struct VertData
|
||||||
float4 colorIn;
|
float4 colorIn;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LineUniform
|
|
||||||
{
|
|
||||||
float4 moduColor;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct VertToFrag
|
struct VertToFrag
|
||||||
{
|
{
|
||||||
float4 position [[ position ]];
|
float4 position [[ position ]];
|
||||||
|
@ -255,44 +384,107 @@ struct VertToFrag
|
||||||
};
|
};
|
||||||
|
|
||||||
vertex VertToFrag vmain(constant VertData* va [[ buffer(0) ]],
|
vertex VertToFrag vmain(constant VertData* va [[ buffer(0) ]],
|
||||||
uint vertId [[ vertex_id ]],
|
uint vertId [[ vertex_id ]])
|
||||||
constant LineUniform& line [[ buffer(2) ]])
|
|
||||||
{
|
{
|
||||||
VertToFrag vtf;
|
VertToFrag vtf;
|
||||||
constant VertData& v = va[vertId];
|
constant VertData& v = va[vertId];
|
||||||
vtf.color = v.colorIn * line.moduColor;
|
vtf.color = v.colorIn;
|
||||||
vtf.position = v.posIn;
|
vtf.position = v.posIn;
|
||||||
return vtf;
|
return vtf;
|
||||||
}
|
}
|
||||||
|
|
||||||
#fragment metal
|
#fragment metal
|
||||||
|
struct Fog
|
||||||
|
{
|
||||||
|
int mode;
|
||||||
|
float4 color;
|
||||||
|
float A;
|
||||||
|
float B;
|
||||||
|
float C;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct LineUniform
|
||||||
|
{
|
||||||
|
float4 moduColor;
|
||||||
|
Fog fog;
|
||||||
|
};
|
||||||
|
|
||||||
struct VertToFrag
|
struct VertToFrag
|
||||||
{
|
{
|
||||||
float4 position [[ position ]];
|
float4 position [[ position ]];
|
||||||
float4 color;
|
float4 color;
|
||||||
};
|
};
|
||||||
|
|
||||||
fragment float4 fmain(VertToFrag vtf [[ stage_in ]])
|
static float4 MainPostFunc(float4 colorIn, constant LineUniform& line, float FragCoord)
|
||||||
{
|
{
|
||||||
return vtf.color;
|
float fogZ;
|
||||||
|
float fogF = saturate((line.fog.A / (line.fog.B - FragCoord.z)) - line.fog.C);
|
||||||
|
switch (line.fog.mode)
|
||||||
|
{
|
||||||
|
case 2:
|
||||||
|
fogZ = fogF;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
fogZ = 1.0 - exp2(-8.0 * fogF);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
fogZ = 1.0 - exp2(-8.0 * fogF * fogF);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
fogZ = exp2(-8.0 * (1.0 - fogF));
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
fogF = 1.0 - fogF;
|
||||||
|
fogZ = exp2(-8.0 * fogF * fogF);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fogZ = 0.0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return float4(mix(colorIn, float4(0.0), saturate(fogZ)).rgb, colorIn.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
|
||||||
|
constant LineUniform& line [[ buffer(2) ]])
|
||||||
|
{
|
||||||
|
return MainPostFunc(vtf.color * line.moduColor, line, vtf.position);
|
||||||
|
}
|
||||||
|
|
||||||
|
#shader CLineRendererShaderNoTexAlphaAWrite : CLineRendererShaderNoTexAlpha
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CLineRendererShaderNoTexAdditive : CLineRendererShaderNoTexAlpha
|
#shader CLineRendererShaderNoTexAdditive : CLineRendererShaderNoTexAlpha
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac one
|
#dstfac one
|
||||||
#depthtest none
|
#depthtest none
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CLineRendererShaderNoTexAdditiveAWrite : CLineRendererShaderNoTexAdditive
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CLineRendererShaderNoTexAlphaZ : CLineRendererShaderNoTexAlpha
|
#shader CLineRendererShaderNoTexAlphaZ : CLineRendererShaderNoTexAlpha
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac invsrcalpha
|
#dstfac invsrcalpha
|
||||||
#depthtest lequal
|
#depthtest lequal
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CLineRendererShaderNoTexAlphaZAWrite : CLineRendererShaderNoTexAlphaZ
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CLineRendererShaderNoTexAdditiveZ : CLineRendererShaderNoTexAlpha
|
#shader CLineRendererShaderNoTexAdditiveZ : CLineRendererShaderNoTexAlpha
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac one
|
#dstfac one
|
||||||
#depthtest lequal
|
#depthtest lequal
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CLineRendererShaderNoTexAdditiveZAWrite : CLineRendererShaderNoTexAdditiveZ
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CLineRendererShaderNoTexAlphaZGEqual : CLineRendererShaderNoTexAlpha
|
#shader CLineRendererShaderNoTexAlphaZGEqual : CLineRendererShaderNoTexAlpha
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac invsrcalpha
|
#dstfac invsrcalpha
|
||||||
#depthtest gequal
|
#depthtest gequal
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CLineRendererShaderNoTexAlphaZGEqualAWrite : CLineRendererShaderNoTexAlphaZGEqual
|
||||||
|
#alphawrite true
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#primitive tristrips
|
#primitive tristrips
|
||||||
#depthtest lequal
|
#depthtest lequal
|
||||||
#depthwrite true
|
#depthwrite true
|
||||||
|
#alphawrite false
|
||||||
#culling none
|
#culling none
|
||||||
|
|
||||||
#vertex glsl
|
#vertex glsl
|
||||||
|
@ -136,27 +137,42 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
|
||||||
return vtf.color * tex.sample(samp, vtf.uv);
|
return vtf.color * tex.sample(samp, vtf.uv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#shader CParticleSwooshShaderTexZWriteAWrite : CParticleSwooshShaderTexZWrite
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CParticleSwooshShaderTexNoZWrite : CParticleSwooshShaderTexZWrite
|
#shader CParticleSwooshShaderTexNoZWrite : CParticleSwooshShaderTexZWrite
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac invsrcalpha
|
#dstfac invsrcalpha
|
||||||
#depthwrite false
|
#depthwrite false
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CParticleSwooshShaderTexNoZWriteAWrite : CParticleSwooshShaderTexNoZWrite
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CParticleSwooshShaderTexAdditiveZWrite : CParticleSwooshShaderTexZWrite
|
#shader CParticleSwooshShaderTexAdditiveZWrite : CParticleSwooshShaderTexZWrite
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac one
|
#dstfac one
|
||||||
#depthwrite true
|
#depthwrite true
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CParticleSwooshShaderTexAdditiveZWriteAWrite : CParticleSwooshShaderTexAdditiveZWrite
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CParticleSwooshShaderTexAdditiveNoZWrite : CParticleSwooshShaderTexZWrite
|
#shader CParticleSwooshShaderTexAdditiveNoZWrite : CParticleSwooshShaderTexZWrite
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac one
|
#dstfac one
|
||||||
#depthwrite false
|
#depthwrite false
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CParticleSwooshShaderTexAdditiveNoZWriteAWrite : CParticleSwooshShaderTexAdditiveNoZWrite
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CParticleSwooshShaderNoTexZWrite : CParticleSwooshShaderTexZWrite
|
#shader CParticleSwooshShaderNoTexZWrite : CParticleSwooshShaderTexZWrite
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac invsrcalpha
|
#dstfac invsrcalpha
|
||||||
#depthtest lequal
|
#depthtest lequal
|
||||||
#depthwrite true
|
#depthwrite true
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
#fragment glsl
|
#fragment glsl
|
||||||
struct VertToFrag
|
struct VertToFrag
|
||||||
|
@ -198,19 +214,32 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]])
|
||||||
return vtf.color;
|
return vtf.color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#shader CParticleSwooshShaderNoTexZWriteAWrite : CParticleSwooshShaderNoTexZWrite
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CParticleSwooshShaderNoTexNoZWrite : CParticleSwooshShaderNoTexZWrite
|
#shader CParticleSwooshShaderNoTexNoZWrite : CParticleSwooshShaderNoTexZWrite
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac invsrcalpha
|
#dstfac invsrcalpha
|
||||||
#depthwrite false
|
#depthwrite false
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CParticleSwooshShaderNoTexNoZWriteAWrite : CParticleSwooshShaderNoTexNoZWrite
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CParticleSwooshShaderNoTexAdditiveZWrite : CParticleSwooshShaderNoTexZWrite
|
#shader CParticleSwooshShaderNoTexAdditiveZWrite : CParticleSwooshShaderNoTexZWrite
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac one
|
#dstfac one
|
||||||
#depthwrite true
|
#depthwrite true
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CParticleSwooshShaderNoTexAdditiveZWriteAWrite : CParticleSwooshShaderNoTexAdditiveZWrite
|
||||||
|
#alphawrite true
|
||||||
|
|
||||||
#shader CParticleSwooshShaderNoTexAdditiveNoZWrite : CParticleSwooshShaderNoTexZWrite
|
#shader CParticleSwooshShaderNoTexAdditiveNoZWrite : CParticleSwooshShaderNoTexZWrite
|
||||||
#srcfac srcalpha
|
#srcfac srcalpha
|
||||||
#dstfac one
|
#dstfac one
|
||||||
#depthwrite false
|
#depthwrite false
|
||||||
|
#alphawrite false
|
||||||
|
|
||||||
|
#shader CParticleSwooshShaderNoTexAdditiveNoZWriteAWrite : CParticleSwooshShaderNoTexAdditiveNoZWrite
|
||||||
|
#alphawrite true
|
||||||
|
|
|
@ -74,12 +74,12 @@ SBINDING(0) in VertToFrag vtf;
|
||||||
layout(location=0) out vec4 colorOut;
|
layout(location=0) out vec4 colorOut;
|
||||||
TBINDING0 uniform sampler2D sceneTex;
|
TBINDING0 uniform sampler2D sceneTex;
|
||||||
TBINDING1 uniform sampler2D noiseTex;
|
TBINDING1 uniform sampler2D noiseTex;
|
||||||
const vec4 kRGBToYPrime = vec4(0.299, 0.587, 0.114, 0.0);
|
const vec4 kRGBToYPrime = vec4(0.257, 0.504, 0.098, 0.0);
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 noiseTexel = texelFetch(noiseTex, Lookup8BPP(vtf.noiseUv, vtf.randOff), 0);
|
vec4 noiseTexel = texelFetch(noiseTex, Lookup8BPP(vtf.noiseUv, vtf.randOff), 0);
|
||||||
vec2 indCoord = (vtf.indMtx * vec3(noiseTexel.r - 0.5, noiseTexel.a - 0.5, 1.0)).xy;
|
vec2 indCoord = (vtf.indMtx * vec3(noiseTexel.r - 0.5, noiseTexel.a - 0.5, 1.0)).xy;
|
||||||
float indScene = dot(texture(sceneTex, vtf.sceneUv + indCoord), kRGBToYPrime);
|
float indScene = dot(texture(sceneTex, vtf.sceneUv + indCoord), kRGBToYPrime) + 16.0 / 255.0;
|
||||||
colorOut = vtf.colorReg0 * indScene + vtf.colorReg2 - vtf.colorReg1 * noiseTexel.r;
|
colorOut = vtf.colorReg0 * indScene + vtf.colorReg2 - vtf.colorReg1 * noiseTexel.r;
|
||||||
colorOut.a = vtf.colorReg1.a + vtf.colorReg1.a * noiseTexel.r + vtf.colorReg2.a;
|
colorOut.a = vtf.colorReg1.a + vtf.colorReg1.a * noiseTexel.r + vtf.colorReg2.a;
|
||||||
}
|
}
|
||||||
|
@ -154,12 +154,12 @@ static int3 Lookup8BPP(float2 uv, float randOff)
|
||||||
return int3(addr & 0x3ff, addr >> 10, 0);
|
return int3(addr & 0x3ff, addr >> 10, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const float4 kRGBToYPrime = {0.299, 0.587, 0.114, 0.0};
|
static const float4 kRGBToYPrime = {0.257, 0.504, 0.098, 0.0};
|
||||||
float4 main(in VertToFrag vtf) : SV_Target0
|
float4 main(in VertToFrag vtf) : SV_Target0
|
||||||
{
|
{
|
||||||
float4 noiseTexel = noiseTex.Load(Lookup8BPP(vtf.noiseUv, vtf.randOff));
|
float4 noiseTexel = noiseTex.Load(Lookup8BPP(vtf.noiseUv, vtf.randOff));
|
||||||
float2 indCoord = mul(vtf.indMtx, float3(noiseTexel.r - 0.5, noiseTexel.a - 0.5, 1.0)).xy;
|
float2 indCoord = mul(vtf.indMtx, float3(noiseTexel.r - 0.5, noiseTexel.a - 0.5, 1.0)).xy;
|
||||||
float indScene = dot(sceneTex.Sample(samp, vtf.sceneUv + indCoord), kRGBToYPrime);
|
float indScene = dot(sceneTex.Sample(samp, vtf.sceneUv + indCoord), kRGBToYPrime) + 16.0 / 255.0;
|
||||||
float4 colorOut = vtf.colorReg0 * indScene + vtf.colorReg2 - vtf.colorReg1 * noiseTexel.r;
|
float4 colorOut = vtf.colorReg0 * indScene + vtf.colorReg2 - vtf.colorReg1 * noiseTexel.r;
|
||||||
colorOut.a = vtf.colorReg1.a + vtf.colorReg1.a * noiseTexel.r + vtf.colorReg2.a;
|
colorOut.a = vtf.colorReg1.a + vtf.colorReg1.a * noiseTexel.r + vtf.colorReg2.a;
|
||||||
return colorOut;
|
return colorOut;
|
||||||
|
@ -238,7 +238,7 @@ static uint2 Lookup8BPP(float2 uv, float randOff)
|
||||||
return uint2(addr & 0x3ff, addr >> 10);
|
return uint2(addr & 0x3ff, addr >> 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
constant float4 kRGBToYPrime = {0.299, 0.587, 0.114, 0.0};
|
constant float4 kRGBToYPrime = {0.257, 0.504, 0.098, 0.0};
|
||||||
fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
|
fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
|
||||||
sampler samp [[ sampler(3) ]],
|
sampler samp [[ sampler(3) ]],
|
||||||
texture2d<float> sceneTex [[ texture(0) ]],
|
texture2d<float> sceneTex [[ texture(0) ]],
|
||||||
|
@ -246,7 +246,7 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
|
||||||
{
|
{
|
||||||
float4 noiseTexel = noiseTex.read(Lookup8BPP(vtf.noiseUv, vtf.randOff));
|
float4 noiseTexel = noiseTex.read(Lookup8BPP(vtf.noiseUv, vtf.randOff));
|
||||||
float2 indCoord = (vtf.indMtx * float3(noiseTexel.r - 0.5, noiseTexel.a - 0.5, 1.0)).xy;
|
float2 indCoord = (vtf.indMtx * float3(noiseTexel.r - 0.5, noiseTexel.a - 0.5, 1.0)).xy;
|
||||||
float indScene = dot(sceneTex.sample(samp, vtf.sceneUv + indCoord), kRGBToYPrime);
|
float indScene = dot(sceneTex.sample(samp, vtf.sceneUv + indCoord), kRGBToYPrime) + 16.0 / 255.0;
|
||||||
float4 colorOut = vtf.colorReg0 * indScene + vtf.colorReg2 - vtf.colorReg1 * noiseTexel.r;
|
float4 colorOut = vtf.colorReg0 * indScene + vtf.colorReg2 - vtf.colorReg1 * noiseTexel.r;
|
||||||
colorOut.a = vtf.colorReg1.a + vtf.colorReg1.a * noiseTexel.r + vtf.colorReg2.a;
|
colorOut.a = vtf.colorReg1.a + vtf.colorReg1.a * noiseTexel.r + vtf.colorReg2.a;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,11 +41,11 @@ SBINDING(0) in VertToFrag vtf;
|
||||||
layout(location=0) out vec4 colorOut;
|
layout(location=0) out vec4 colorOut;
|
||||||
TBINDING0 uniform sampler2D sceneTex;
|
TBINDING0 uniform sampler2D sceneTex;
|
||||||
TBINDING1 uniform sampler2D paletteTex;
|
TBINDING1 uniform sampler2D paletteTex;
|
||||||
const vec4 kRGBToYPrime = vec4(0.299, 0.587, 0.114, 0.0);
|
const vec4 kRGBToYPrime = vec4(0.257, 0.504, 0.098, 0.0);
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
float sceneSample = dot(texture(sceneTex, vtf.sceneUv), kRGBToYPrime);
|
float sceneSample = dot(texture(sceneTex, vtf.sceneUv), kRGBToYPrime) + 16.0 / 255.0;
|
||||||
vec4 colorSample = texture(paletteTex, vec2(sceneSample / 17.0, 0.5));
|
vec4 colorSample = texture(paletteTex, vec2(sceneSample / 16.0, 0.5));
|
||||||
colorOut = vec4(colorSample.rgb, 0.0);
|
colorOut = vec4(colorSample.rgb, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,11 +88,11 @@ struct VertToFrag
|
||||||
float2 sceneUv : UV;
|
float2 sceneUv : UV;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const float4 kRGBToYPrime = float4(0.299, 0.587, 0.114, 0.0);
|
static const float4 kRGBToYPrime = float4(0.257, 0.504, 0.098, 0.0);
|
||||||
float4 main(in VertToFrag vtf) : SV_Target0
|
float4 main(in VertToFrag vtf) : SV_Target0
|
||||||
{
|
{
|
||||||
float sceneSample = dot(sceneTex.Sample(samp, vtf.sceneUv), kRGBToYPrime);
|
float sceneSample = dot(sceneTex.Sample(samp, vtf.sceneUv), kRGBToYPrime) + 16.0 / 255.0;
|
||||||
float4 colorSample = paletteTex.Sample(samp, float2(sceneSample / 17.0, 0.5));
|
float4 colorSample = paletteTex.Sample(samp, float2(sceneSample / 16.0, 0.5));
|
||||||
return float4(colorSample.rgb, 0.0);
|
return float4(colorSample.rgb, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,13 +132,13 @@ struct VertToFrag
|
||||||
float2 sceneUv;
|
float2 sceneUv;
|
||||||
};
|
};
|
||||||
|
|
||||||
constant float4 kRGBToYPrime = float4(0.299, 0.587, 0.114, 0.0);
|
constant float4 kRGBToYPrime = float4(0.257, 0.504, 0.098, 0.0);
|
||||||
fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
|
fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
|
||||||
sampler samp [[ sampler(0) ]],
|
sampler samp [[ sampler(0) ]],
|
||||||
texture2d<float> sceneTex [[ texture(0) ]],
|
texture2d<float> sceneTex [[ texture(0) ]],
|
||||||
texture2d<float> paletteTex [[ texture(1) ]])
|
texture2d<float> paletteTex [[ texture(1) ]])
|
||||||
{
|
{
|
||||||
float sceneSample = dot(sceneTex.sample(samp, vtf.sceneUv), kRGBToYPrime);
|
float sceneSample = dot(sceneTex.sample(samp, vtf.sceneUv), kRGBToYPrime) + 16.0 / 255.0;
|
||||||
float4 colorSample = paletteTex.sample(samp, float2(sceneSample / 17.0, 0.5));
|
float4 colorSample = paletteTex.sample(samp, float2(sceneSample / 16.0, 0.5));
|
||||||
return float4(colorSample.rgb, 0.0);
|
return float4(colorSample.rgb, 0.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,50 @@
|
||||||
#include "shader_CFluidPlaneShader.hpp"
|
#include "shader_CFluidPlaneShader.hpp"
|
||||||
|
|
||||||
|
#define FOG_STRUCT_GLSL \
|
||||||
|
"struct Fog\n" \
|
||||||
|
"{\n" \
|
||||||
|
" int mode;\n" \
|
||||||
|
" vec4 color;\n" \
|
||||||
|
" float A;\n" \
|
||||||
|
" float B;\n" \
|
||||||
|
" float C;\n" \
|
||||||
|
" float indScale;\n" \
|
||||||
|
"};\n"
|
||||||
|
|
||||||
|
#define FOG_ALGORITHM_GLSL \
|
||||||
|
"vec4 MainPostFunc(vec4 colorIn)\n" \
|
||||||
|
"{\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 = fogF;\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" case 4:\n" \
|
||||||
|
" fogZ = 1.0 - exp2(-8.0 * fogF);\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" case 5:\n" \
|
||||||
|
" fogZ = 1.0 - exp2(-8.0 * fogF * fogF);\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" case 6:\n" \
|
||||||
|
" fogZ = exp2(-8.0 * (1.0 - fogF));\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" case 7:\n" \
|
||||||
|
" fogF = 1.0 - fogF;\n" \
|
||||||
|
" fogZ = exp2(-8.0 * fogF * fogF);\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" default:\n" \
|
||||||
|
" fogZ = 0.0;\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" }\n" \
|
||||||
|
"#if %d\n" \
|
||||||
|
" return vec4(mix(colorIn, vec4(0.0), clamp(fogZ, 0.0, 1.0)).rgb, colorIn.a);\n" \
|
||||||
|
"#else\n" \
|
||||||
|
" return vec4(mix(colorIn, fog.color, clamp(fogZ, 0.0, 1.0)).rgb, colorIn.a);\n" \
|
||||||
|
"#endif\n" \
|
||||||
|
"}\n"
|
||||||
|
|
||||||
static const char* VS =
|
static const char* VS =
|
||||||
"layout(location=0) in vec4 posIn;\n"
|
"layout(location=0) in vec4 posIn;\n"
|
||||||
"layout(location=1) in vec4 normalIn;\n"
|
"layout(location=1) in vec4 normalIn;\n"
|
||||||
|
@ -175,14 +220,7 @@ static const char* FS =
|
||||||
" vec4 linAtt;\n"
|
" vec4 linAtt;\n"
|
||||||
" vec4 angAtt;\n"
|
" vec4 angAtt;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"struct Fog\n" // Reappropriated for indirect texture scaling
|
FOG_STRUCT_GLSL
|
||||||
"{\n"
|
|
||||||
" int mode;\n"
|
|
||||||
" vec4 color;\n"
|
|
||||||
" float rangeScale;\n"
|
|
||||||
" float start;\n"
|
|
||||||
" float indScale;\n"
|
|
||||||
"};\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
"UBINDING2 uniform LightingUniform\n"
|
"UBINDING2 uniform LightingUniform\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -229,38 +267,7 @@ static const char* FS =
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
"SBINDING(0) in VertToFrag vtf;\n"
|
"SBINDING(0) in VertToFrag vtf;\n"
|
||||||
"vec4 MainPostFunc(vec4 colorIn)\n"
|
FOG_ALGORITHM_GLSL
|
||||||
"{\n"
|
|
||||||
" float fogZ, temp;\n"
|
|
||||||
" switch (fog.mode)\n"
|
|
||||||
" {\n"
|
|
||||||
" case 2:\n"
|
|
||||||
" fogZ = (-vtf.mvPos.z - fog.start) * fog.rangeScale;\n"
|
|
||||||
" break;\n"
|
|
||||||
" case 4:\n"
|
|
||||||
" fogZ = 1.0 - exp2(-8.0 * (-vtf.mvPos.z - fog.start) * fog.rangeScale);\n"
|
|
||||||
" break;\n"
|
|
||||||
" case 5:\n"
|
|
||||||
" temp = (-vtf.mvPos.z - fog.start) * fog.rangeScale;\n"
|
|
||||||
" fogZ = 1.0 - exp2(-8.0 * temp * temp);\n"
|
|
||||||
" break;\n"
|
|
||||||
" case 6:\n"
|
|
||||||
" fogZ = exp2(-8.0 * (fog.start + vtf.mvPos.z) * fog.rangeScale);\n"
|
|
||||||
" break;\n"
|
|
||||||
" case 7:\n"
|
|
||||||
" temp = (fog.start + vtf.mvPos.z) * fog.rangeScale;\n"
|
|
||||||
" fogZ = exp2(-8.0 * temp * temp);\n"
|
|
||||||
" break;\n"
|
|
||||||
" default:\n"
|
|
||||||
" fogZ = 0.0;\n"
|
|
||||||
" break;\n"
|
|
||||||
" }\n"
|
|
||||||
"#if %d\n"
|
|
||||||
" return vec4(mix(colorIn, vec4(0.0), clamp(fogZ, 0.0, 1.0)).rgb, colorIn.a);\n"
|
|
||||||
"#else\n"
|
|
||||||
" return vec4(mix(colorIn, fog.color, clamp(fogZ, 0.0, 1.0)).rgb, colorIn.a);\n"
|
|
||||||
"#endif\n"
|
|
||||||
"}\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
"layout(location=0) out vec4 colorOut;\n"
|
"layout(location=0) out vec4 colorOut;\n"
|
||||||
"%s" // Textures here
|
"%s" // Textures here
|
||||||
|
@ -281,14 +288,7 @@ static const char* FSDoor =
|
||||||
" vec4 linAtt;\n"
|
" vec4 linAtt;\n"
|
||||||
" vec4 angAtt;\n"
|
" vec4 angAtt;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"struct Fog\n" // Reappropriated for indirect texture scaling
|
FOG_STRUCT_GLSL
|
||||||
"{\n"
|
|
||||||
" int mode;\n"
|
|
||||||
" vec4 color;\n"
|
|
||||||
" float rangeScale;\n"
|
|
||||||
" float start;\n"
|
|
||||||
" float indScale;\n"
|
|
||||||
"};\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
"UBINDING2 uniform LightingUniform\n"
|
"UBINDING2 uniform LightingUniform\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -311,6 +311,7 @@ static const char* FSDoor =
|
||||||
" vec4 color;\n"
|
" vec4 color;\n"
|
||||||
" vec2 uvs[7];\n"
|
" vec2 uvs[7];\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
|
FOG_ALGORITHM_GLSL
|
||||||
"\n"
|
"\n"
|
||||||
"SBINDING(0) in VertToFrag vtf;\n"
|
"SBINDING(0) in VertToFrag vtf;\n"
|
||||||
"layout(location=0) out vec4 colorOut;\n"
|
"layout(location=0) out vec4 colorOut;\n"
|
||||||
|
@ -318,6 +319,7 @@ static const char* FSDoor =
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
"%s" // Combiner expression here
|
"%s" // Combiner expression here
|
||||||
|
" colorOut = MainPostFunc(colorOut);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
static std::string _BuildFS(const SFluidPlaneShaderInfo& info) {
|
static std::string _BuildFS(const SFluidPlaneShaderInfo& info) {
|
||||||
|
@ -766,7 +768,7 @@ static std::string _BuildFS(const SFluidPlaneDoorShaderInfo& info) {
|
||||||
combiner += " colorOut.a = kColor0.a;\n";
|
combiner += " colorOut.a = kColor0.a;\n";
|
||||||
|
|
||||||
char* finalFSs;
|
char* finalFSs;
|
||||||
asprintf(&finalFSs, FSDoor, textures.c_str(), combiner.c_str());
|
asprintf(&finalFSs, FSDoor, 0, textures.c_str(), combiner.c_str());
|
||||||
std::string ret(finalFSs);
|
std::string ret(finalFSs);
|
||||||
free(finalFSs);
|
free(finalFSs);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -1,5 +1,50 @@
|
||||||
#include "shader_CFluidPlaneShader.hpp"
|
#include "shader_CFluidPlaneShader.hpp"
|
||||||
|
|
||||||
|
#define FOG_STRUCT_HLSL \
|
||||||
|
"struct Fog\n" \
|
||||||
|
"{\n" \
|
||||||
|
" int mode;\n" \
|
||||||
|
" float4 color;\n" \
|
||||||
|
" float A;\n" \
|
||||||
|
" float B;\n" \
|
||||||
|
" float C;\n" \
|
||||||
|
" float indScale;\n" \
|
||||||
|
"};\n"
|
||||||
|
|
||||||
|
#define FOG_ALGORITHM_HLSL \
|
||||||
|
"static float4 MainPostFunc(in VertToFrag vtf, float4 colorIn)\n" \
|
||||||
|
"{\n" \
|
||||||
|
" float fogZ;\n" \
|
||||||
|
" float fogF = saturate((fog.A / (fog.B - vtf.pos.z)) - fog.C);\n" \
|
||||||
|
" switch (fog.mode)\n" \
|
||||||
|
" {\n" \
|
||||||
|
" case 2:\n" \
|
||||||
|
" fogZ = fogF;\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" case 4:\n" \
|
||||||
|
" fogZ = 1.0 - exp2(-8.0 * fogF);\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" case 5:\n" \
|
||||||
|
" fogZ = 1.0 - exp2(-8.0 * fogF * fogF);\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" case 6:\n" \
|
||||||
|
" fogZ = exp2(-8.0 * (1.0 - fogF));\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" case 7:\n" \
|
||||||
|
" fogF = 1.0 - fogF;\n" \
|
||||||
|
" fogZ = exp2(-8.0 * fogF * fogF);\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" default:\n" \
|
||||||
|
" fogZ = 0.0;\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" }\n" \
|
||||||
|
"#if %d\n" \
|
||||||
|
" return float4(lerp(colorIn, float4(0.0,0.0,0.0,0.0), saturate(fogZ)).rgb, colorIn.a);\n" \
|
||||||
|
"#else\n" \
|
||||||
|
" return float4(lerp(colorIn, fog.color, saturate(fogZ)).rgb, colorIn.a);\n" \
|
||||||
|
"#endif\n" \
|
||||||
|
"}\n"
|
||||||
|
|
||||||
static const char* VS =
|
static const char* VS =
|
||||||
"struct VertData\n"
|
"struct VertData\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -211,14 +256,7 @@ static const char* FS =
|
||||||
" float4 linAtt;\n"
|
" float4 linAtt;\n"
|
||||||
" float4 angAtt;\n"
|
" float4 angAtt;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"struct Fog\n" // Reappropriated for indirect texture scaling
|
FOG_STRUCT_HLSL
|
||||||
"{\n"
|
|
||||||
" int mode;\n"
|
|
||||||
" float4 color;\n"
|
|
||||||
" float rangeScale;\n"
|
|
||||||
" float start;\n"
|
|
||||||
" float indScale;\n"
|
|
||||||
"};\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
"cbuffer LightingUniform : register(b2)\n"
|
"cbuffer LightingUniform : register(b2)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -264,38 +302,7 @@ static const char* FS =
|
||||||
" float2 uvs[7] : UV;\n"
|
" float2 uvs[7] : UV;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
"static float4 MainPostFunc(in VertToFrag vtf, float4 colorIn)\n"
|
FOG_ALGORITHM_HLSL
|
||||||
"{\n"
|
|
||||||
" float fogZ, temp;\n"
|
|
||||||
" switch (fog.mode)\n"
|
|
||||||
" {\n"
|
|
||||||
" case 2:\n"
|
|
||||||
" fogZ = (-vtf.mvPos.z - fog.start) * fog.rangeScale;\n"
|
|
||||||
" break;\n"
|
|
||||||
" case 4:\n"
|
|
||||||
" fogZ = 1.0 - exp2(-8.0 * (-vtf.mvPos.z - fog.start) * fog.rangeScale);\n"
|
|
||||||
" break;\n"
|
|
||||||
" case 5:\n"
|
|
||||||
" temp = (-vtf.mvPos.z - fog.start) * fog.rangeScale;\n"
|
|
||||||
" fogZ = 1.0 - exp2(-8.0 * temp * temp);\n"
|
|
||||||
" break;\n"
|
|
||||||
" case 6:\n"
|
|
||||||
" fogZ = exp2(-8.0 * (fog.start + vtf.mvPos.z) * fog.rangeScale);\n"
|
|
||||||
" break;\n"
|
|
||||||
" case 7:\n"
|
|
||||||
" temp = (fog.start + vtf.mvPos.z) * fog.rangeScale;\n"
|
|
||||||
" fogZ = exp2(-8.0 * temp * temp);\n"
|
|
||||||
" break;\n"
|
|
||||||
" default:\n"
|
|
||||||
" fogZ = 0.0;\n"
|
|
||||||
" break;\n"
|
|
||||||
" }\n"
|
|
||||||
"#if %d\n"
|
|
||||||
" return float4(lerp(colorIn, float4(0.0, 0.0, 0.0, 0.0), saturate(fogZ)).rgb, colorIn.a);\n"
|
|
||||||
"#else\n"
|
|
||||||
" return float4(lerp(colorIn, fog.color, saturate(fogZ)).rgb, colorIn.a);\n"
|
|
||||||
"#endif\n"
|
|
||||||
"}\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
"SamplerState samp : register(s0);\n"
|
"SamplerState samp : register(s0);\n"
|
||||||
"%s" // Textures here
|
"%s" // Textures here
|
||||||
|
@ -316,14 +323,7 @@ static const char* FSDoor =
|
||||||
" float4 linAtt;\n"
|
" float4 linAtt;\n"
|
||||||
" float4 angAtt;\n"
|
" float4 angAtt;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"struct Fog\n" // Reappropriated for indirect texture scaling
|
FOG_STRUCT_HLSL
|
||||||
"{\n"
|
|
||||||
" int mode;\n"
|
|
||||||
" float4 color;\n"
|
|
||||||
" float rangeScale;\n"
|
|
||||||
" float start;\n"
|
|
||||||
" float indScale;\n"
|
|
||||||
"};\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
"cbuffer LightingUniform : register(b2)\n"
|
"cbuffer LightingUniform : register(b2)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -346,6 +346,7 @@ static const char* FSDoor =
|
||||||
" float4 color : COLOR;\n"
|
" float4 color : COLOR;\n"
|
||||||
" float2 uvs[7] : UV;\n"
|
" float2 uvs[7] : UV;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
|
FOG_ALGORITHM_HLSL
|
||||||
"\n"
|
"\n"
|
||||||
"SamplerState samp : register(s0);\n"
|
"SamplerState samp : register(s0);\n"
|
||||||
"%s" // Textures here
|
"%s" // Textures here
|
||||||
|
@ -353,7 +354,7 @@ static const char* FSDoor =
|
||||||
"{\n"
|
"{\n"
|
||||||
" float4 colorOut;\n"
|
" float4 colorOut;\n"
|
||||||
"%s" // Combiner expression here
|
"%s" // Combiner expression here
|
||||||
" return colorOut;\n"
|
" return MainPostFunc(vtf, colorOut);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
static std::string _BuildFS(const SFluidPlaneShaderInfo& info) {
|
static std::string _BuildFS(const SFluidPlaneShaderInfo& info) {
|
||||||
|
@ -761,7 +762,7 @@ static std::string _BuildFS(const SFluidPlaneDoorShaderInfo& info) {
|
||||||
combiner += " colorOut.a = kColor0.a;\n";
|
combiner += " colorOut.a = kColor0.a;\n";
|
||||||
|
|
||||||
char* finalFSs;
|
char* finalFSs;
|
||||||
asprintf(&finalFSs, FSDoor, textures.c_str(), combiner.c_str());
|
asprintf(&finalFSs, FSDoor, 0, textures.c_str(), combiner.c_str());
|
||||||
std::string ret(finalFSs);
|
std::string ret(finalFSs);
|
||||||
free(finalFSs);
|
free(finalFSs);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -1,5 +1,50 @@
|
||||||
#include "shader_CFluidPlaneShader.hpp"
|
#include "shader_CFluidPlaneShader.hpp"
|
||||||
|
|
||||||
|
#define FOG_STRUCT_METAL \
|
||||||
|
"struct Fog\n" \
|
||||||
|
"{\n" \
|
||||||
|
" int mode;\n" \
|
||||||
|
" float4 color;\n" \
|
||||||
|
" float A;\n" \
|
||||||
|
" float B;\n" \
|
||||||
|
" float C;\n" \
|
||||||
|
" float indScale;\n" \
|
||||||
|
"};\n"
|
||||||
|
|
||||||
|
#define FOG_ALGORITHM_METAL \
|
||||||
|
"static float4 MainPostFunc(thread VertToFrag& vtf, constant LightingUniform& lu, float4 colorIn)\n" \
|
||||||
|
"{\n" \
|
||||||
|
" float fogZ;\n" \
|
||||||
|
" float fogF = saturate((lu.fog.A / (lu.fog.B - vtf.pos.z)) - lu.fog.C);\n" \
|
||||||
|
" switch (lu.fog.mode)\n" \
|
||||||
|
" {\n" \
|
||||||
|
" case 2:\n" \
|
||||||
|
" fogZ = fogF;\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" case 4:\n" \
|
||||||
|
" fogZ = 1.0 - exp2(-8.0 * fogF);\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" case 5:\n" \
|
||||||
|
" fogZ = 1.0 - exp2(-8.0 * fogF * fogF);\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" case 6:\n" \
|
||||||
|
" fogZ = exp2(-8.0 * (1.0 - fogF));\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" case 7:\n" \
|
||||||
|
" fogF = 1.0 - fogF;\n" \
|
||||||
|
" fogZ = exp2(-8.0 * fogF * fogF);\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" default:\n" \
|
||||||
|
" fogZ = 0.0;\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" }\n" \
|
||||||
|
"#if %d\n" \
|
||||||
|
" return float4(mix(colorIn, float4(0.0), saturate(fogZ)).rgb, colorIn.a);\n" \
|
||||||
|
"#else\n" \
|
||||||
|
" return float4(mix(colorIn, fog.color, saturate(fogZ)).rgb, colorIn.a);\n" \
|
||||||
|
"#endif\n" \
|
||||||
|
"}\n"
|
||||||
|
|
||||||
static const char* VS =
|
static const char* VS =
|
||||||
"struct VertData\n"
|
"struct VertData\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -195,14 +240,7 @@ static const char* FS =
|
||||||
" float4 linAtt;\n"
|
" float4 linAtt;\n"
|
||||||
" float4 angAtt;\n"
|
" float4 angAtt;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"struct Fog\n" // Reappropriated for indirect texture scaling
|
FOG_STRUCT_METAL
|
||||||
"{\n"
|
|
||||||
" int mode;\n"
|
|
||||||
" float4 color;\n"
|
|
||||||
" float rangeScale;\n"
|
|
||||||
" float start;\n"
|
|
||||||
" float indScale;\n"
|
|
||||||
"};\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
"struct LightingUniform\n"
|
"struct LightingUniform\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -254,38 +292,7 @@ static const char* FS =
|
||||||
" float2 uv6;\n"
|
" float2 uv6;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
"float4 MainPostFunc(thread VertToFrag& vtf, constant LightingUniform& lu, float4 colorIn)\n"
|
FOG_ALGORITHM_METAL
|
||||||
"{\n"
|
|
||||||
" float fogZ, temp;\n"
|
|
||||||
" switch (lu.fog.mode)\n"
|
|
||||||
" {\n"
|
|
||||||
" case 2:\n"
|
|
||||||
" fogZ = (-vtf.mvPos.z - lu.fog.start) * lu.fog.rangeScale;\n"
|
|
||||||
" break;\n"
|
|
||||||
" case 4:\n"
|
|
||||||
" fogZ = 1.0 - exp2(-8.0 * (-vtf.mvPos.z - lu.fog.start) * lu.fog.rangeScale);\n"
|
|
||||||
" break;\n"
|
|
||||||
" case 5:\n"
|
|
||||||
" temp = (-vtf.mvPos.z - lu.fog.start) * lu.fog.rangeScale;\n"
|
|
||||||
" fogZ = 1.0 - exp2(-8.0 * temp * temp);\n"
|
|
||||||
" break;\n"
|
|
||||||
" case 6:\n"
|
|
||||||
" fogZ = exp2(-8.0 * (lu.fog.start + vtf.mvPos.z) * lu.fog.rangeScale);\n"
|
|
||||||
" break;\n"
|
|
||||||
" case 7:\n"
|
|
||||||
" temp = (lu.fog.start + vtf.mvPos.z) * lu.fog.rangeScale;\n"
|
|
||||||
" fogZ = exp2(-8.0 * temp * temp);\n"
|
|
||||||
" break;\n"
|
|
||||||
" default:\n"
|
|
||||||
" fogZ = 0.0;\n"
|
|
||||||
" break;\n"
|
|
||||||
" }\n"
|
|
||||||
"#if %d\n"
|
|
||||||
" return float4(mix(colorIn, float4(0.0), saturate(fogZ)).rgb, colorIn.a);\n"
|
|
||||||
"#else\n"
|
|
||||||
" return float4(mix(colorIn, lu.fog.color, saturate(fogZ)).rgb, colorIn.a);\n"
|
|
||||||
"#endif\n"
|
|
||||||
"}\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
"fragment float4 fmain(VertToFrag vtf [[ stage_in ]],\n"
|
"fragment float4 fmain(VertToFrag vtf [[ stage_in ]],\n"
|
||||||
" sampler samp [[ sampler(0) ]],\n"
|
" sampler samp [[ sampler(0) ]],\n"
|
||||||
|
@ -306,14 +313,7 @@ static const char* FSDoor =
|
||||||
" float4 linAtt;\n"
|
" float4 linAtt;\n"
|
||||||
" float4 angAtt;\n"
|
" float4 angAtt;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"struct Fog\n" // Reappropriated for indirect texture scaling
|
FOG_STRUCT_METAL
|
||||||
"{\n"
|
|
||||||
" int mode;\n"
|
|
||||||
" float4 color;\n"
|
|
||||||
" float rangeScale;\n"
|
|
||||||
" float start;\n"
|
|
||||||
" float indScale;\n"
|
|
||||||
"};\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
"struct LightingUniform\n"
|
"struct LightingUniform\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -343,6 +343,7 @@ static const char* FSDoor =
|
||||||
" float2 uv5;\n"
|
" float2 uv5;\n"
|
||||||
" float2 uv6;\n"
|
" float2 uv6;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
|
FOG_ALGORITHM_METAL
|
||||||
"\n"
|
"\n"
|
||||||
"fragment float4 fmain(VertToFrag vtf [[ stage_in ]],\n"
|
"fragment float4 fmain(VertToFrag vtf [[ stage_in ]],\n"
|
||||||
" sampler samp [[ sampler(0) ]],\n"
|
" sampler samp [[ sampler(0) ]],\n"
|
||||||
|
@ -350,7 +351,7 @@ static const char* FSDoor =
|
||||||
"{\n"
|
"{\n"
|
||||||
" float4 colorOut;\n"
|
" float4 colorOut;\n"
|
||||||
"%s" // Combiner expression here
|
"%s" // Combiner expression here
|
||||||
" return colorOut;\n"
|
" return MainPostFunc(vtf, lu, colorOut);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
static std::string _BuildFS(const SFluidPlaneShaderInfo& info) {
|
static std::string _BuildFS(const SFluidPlaneShaderInfo& info) {
|
||||||
|
@ -748,7 +749,7 @@ static std::string _BuildFS(const SFluidPlaneDoorShaderInfo& info) {
|
||||||
combiner += " colorOut.a = lu.kColor0.a;\n";
|
combiner += " colorOut.a = lu.kColor0.a;\n";
|
||||||
|
|
||||||
char* finalFSs;
|
char* finalFSs;
|
||||||
asprintf(&finalFSs, FSDoor, textures.c_str(), combiner.c_str());
|
asprintf(&finalFSs, FSDoor, 0, textures.c_str(), combiner.c_str());
|
||||||
std::string ret(finalFSs);
|
std::string ret(finalFSs);
|
||||||
free(finalFSs);
|
free(finalFSs);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
||||||
Subproject commit 6e15025d2b8ed64191ebdf50a815a302368944ef
|
Subproject commit bfd649cd9f2b9d4382d83d5b0971f97e0ac98d84
|
Loading…
Reference in New Issue