mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-08-10 06:19:06 +00:00
Proper interleaved rendering of indirect-textured particle instances
This commit is contained in:
parent
d6051f8808
commit
3ef7386978
@ -356,9 +356,9 @@ public:
|
|||||||
boo::SWindowRect wrect = {rect.x4_left, rect.x8_top, rect.xc_width, rect.x10_height};
|
boo::SWindowRect wrect = {rect.x4_left, rect.x8_top, rect.xc_width, rect.x10_height};
|
||||||
g_BooMainCommandQueue->resolveBindTexture(g_SpareTexture, wrect, true, bindIdx, false, true);
|
g_BooMainCommandQueue->resolveBindTexture(g_SpareTexture, wrect, true, bindIdx, false, true);
|
||||||
}
|
}
|
||||||
static void DrawInstances(size_t start, size_t count, size_t instCount)
|
static void DrawInstances(size_t start, size_t count, size_t instCount, size_t startInst = 0)
|
||||||
{
|
{
|
||||||
g_BooMainCommandQueue->drawInstances(start, count, instCount);
|
g_BooMainCommandQueue->drawInstances(start, count, instCount, startInst);
|
||||||
}
|
}
|
||||||
static void DrawArray(size_t start, size_t count)
|
static void DrawArray(size_t start, size_t count)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ void CEnvFxShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& c
|
|||||||
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {uBufInfo.first.get(),
|
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {uBufInfo.first.get(),
|
||||||
fxMgr.m_fogUniformBuf.get()};
|
fxMgr.m_fogUniformBuf.get()};
|
||||||
size_t ubufOffsets[] = {uBufInfo.second, 0};
|
size_t ubufOffsets[] = {uBufInfo.second, 0};
|
||||||
size_t ubufSizes[] = {256, 256};
|
size_t ubufSizes[] = {sizeof(CEnvFxShaders::Uniform), sizeof(CGraphics::g_Fog)};
|
||||||
boo::PipelineStage uniformStages[] = {boo::PipelineStage::Vertex, boo::PipelineStage::Fragment};
|
boo::PipelineStage uniformStages[] = {boo::PipelineStage::Vertex, boo::PipelineStage::Fragment};
|
||||||
boo::ObjToken<boo::ITexture> textures[] = {fxMgr.xb74_txtrSnowFlake->GetBooTexture(),
|
boo::ObjToken<boo::ITexture> textures[] = {fxMgr.xb74_txtrSnowFlake->GetBooTexture(),
|
||||||
fxMgr.x40_txtrEnvGradient->GetBooTexture()};
|
fxMgr.x40_txtrEnvGradient->GetBooTexture()};
|
||||||
|
@ -1876,6 +1876,9 @@ void CElementGen::RenderParticlesIndirectTexture()
|
|||||||
g_instIndTexData.clear();
|
g_instIndTexData.clear();
|
||||||
g_instIndTexData.reserve(x30_particles.size());
|
g_instIndTexData.reserve(x30_particles.size());
|
||||||
|
|
||||||
|
if (!x30_particles.empty())
|
||||||
|
CGraphics::SetShaderDataBinding(m_normalDataBind);
|
||||||
|
|
||||||
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;
|
||||||
@ -1945,13 +1948,14 @@ void CElementGen::RenderParticlesIndirectTexture()
|
|||||||
inst.sceneUVs = zeus::CVector4f{clipRect.x18_uvXMin, 1.f - clipRect.x24_uvYMax, clipRect.x1c_uvXMax, 1.f - clipRect.x20_uvYMin};
|
inst.sceneUVs = zeus::CVector4f{clipRect.x18_uvXMin, 1.f - clipRect.x24_uvYMax, clipRect.x1c_uvXMax, 1.f - clipRect.x20_uvYMin};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
CGraphics::DrawInstances(0, 4, 1, g_instIndTexData.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_instIndTexData.size())
|
if (g_instIndTexData.size())
|
||||||
{
|
{
|
||||||
m_instBuf->load(g_instIndTexData.data(), g_instIndTexData.size() * sizeof(SParticleInstanceIndTex));
|
m_instBuf->load(g_instIndTexData.data(), g_instIndTexData.size() * sizeof(SParticleInstanceIndTex));
|
||||||
CGraphics::SetShaderDataBinding(m_normalDataBind);
|
//CGraphics::SetShaderDataBinding(m_normalDataBind);
|
||||||
CGraphics::DrawInstances(0, 4, g_instIndTexData.size());
|
//CGraphics::DrawInstances(0, 4, g_instIndTexData.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
hecl
2
hecl
@ -1 +1 @@
|
|||||||
Subproject commit 26541cd2b460592049b75b9612562fa6b7d01cc5
|
Subproject commit 75e7dc2e871e4ca41d9691737259455fb337dc15
|
Loading…
x
Reference in New Issue
Block a user