mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-06-01 22:41:20 +00:00
Fog rendering for Metal
This commit is contained in:
parent
1d32843970
commit
2d73c8226c
@ -12,6 +12,12 @@ static const char* LightingMetal =
|
||||
" float4 linAtt;\n"
|
||||
" float4 angAtt;\n"
|
||||
"};\n"
|
||||
"struct Fog\n"
|
||||
"{\n"
|
||||
" float4 color;\n"
|
||||
" float rangeScale;\n"
|
||||
" float start;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"struct LightingUniform\n"
|
||||
"{\n"
|
||||
@ -20,6 +26,7 @@ static const char* LightingMetal =
|
||||
" float4 colorReg0;\n"
|
||||
" float4 colorReg1;\n"
|
||||
" float4 colorReg2;\n"
|
||||
" Fog fog;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"static float4 LightingFunc(constant LightingUniform& lu, float4 mvPosIn, float4 mvNormIn)\n"
|
||||
@ -43,6 +50,14 @@ static const char* LightingMetal =
|
||||
" return saturate(ret);\n"
|
||||
"}\n";
|
||||
|
||||
static const char* MainPostMetal =
|
||||
"float4 MainPostFunc(thread VertToFrag& vtf, constant LightingUniform& lu, float4 colorIn)\n"
|
||||
"{\n"
|
||||
" float fogZ = (-vtf.mvPos.z - lu.fog.start) * lu.fog.rangeScale;\n"
|
||||
" return mix(lu.fog.color, colorIn, saturate(exp2(-8.0 * fogZ)));\n"
|
||||
"}\n"
|
||||
"\n";
|
||||
|
||||
static const char* ThermalPostMetal =
|
||||
"struct ThermalUniform\n"
|
||||
"{\n"
|
||||
@ -64,7 +79,7 @@ CModelShaders::GetShaderExtensionsMetal(boo::IGraphicsDataFactory::Platform plat
|
||||
hecl::Runtime::ShaderCacheExtensions ext(plat);
|
||||
|
||||
/* Normal lit shading */
|
||||
ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {}, 1, BlockNames, 0, nullptr,
|
||||
ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"}, 1, BlockNames, 0, nullptr,
|
||||
hecl::Backend::BlendFactor::Original, hecl::Backend::BlendFactor::Original);
|
||||
|
||||
/* Thermal Visor shading */
|
||||
|
@ -615,7 +615,7 @@ u32 CGameArea::GetNumPartSizes() const
|
||||
|
||||
void CGameArea::AllocNewAreaData(int offset, int size)
|
||||
{
|
||||
x110_mreaSecBufs.emplace_back(new u8[size], size);
|
||||
x110_mreaSecBufs.emplace_back(std::unique_ptr<u8[]>(new u8[size]), size);
|
||||
xf8_loadTransactions.push_back(
|
||||
static_cast<ProjectResourceFactoryBase*>(g_ResFactory)->
|
||||
LoadResourcePartAsync(SObjectTag{FOURCC('MREA'), x84_mrea}, size, offset,
|
||||
|
2
hecl
2
hecl
@ -1 +1 @@
|
||||
Subproject commit da8e8021f1417d213d18d783d779bd8eeb435be2
|
||||
Subproject commit 0ab6b7c072be623b687c1264c314c69aaccfa83e
|
Loading…
x
Reference in New Issue
Block a user