2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 14:24:56 +00:00

Various rendering fixes

This commit is contained in:
Jack Andersen
2019-03-02 20:19:42 -10:00
parent ca5cf5c77c
commit 8b9f073635
32 changed files with 948 additions and 552 deletions

View File

@@ -9,6 +9,8 @@
#include "Graphics/Shaders/CElementGenShaders.hpp"
#include "Character/CActorLights.hpp"
#include "CWarp.hpp"
#include "GameGlobalObjects.hpp"
#include "Graphics/CBooRenderer.hpp"
#define MAX_GLOBAL_PARTICLES 2560
@@ -881,9 +883,9 @@ void CElementGen::RenderModels(const CActorLights* actorLights) {
m_uniformBufPmus->load(&uniformData, sizeof(SParticleUniforms));
if (moveRedToAlphaBuffer)
CGraphics::SetShaderDataBinding(m_redToAlphaDataBindPmus);
CGraphics::SetShaderDataBinding(m_redToAlphaDataBindPmus[g_Renderer->IsThermalVisorHotPass()]);
else
CGraphics::SetShaderDataBinding(m_normalDataBindPmus);
CGraphics::SetShaderDataBinding(m_normalDataBindPmus[g_Renderer->IsThermalVisorHotPass()]);
}
zeus::CTransform orient = zeus::CTransform();
@@ -1149,7 +1151,7 @@ void CElementGen::RenderLines() {
}
}
m_lineRenderer->Render(moduColor);
m_lineRenderer->Render(g_Renderer->IsThermalVisorHotPass(), moduColor);
}
void CElementGen::RenderParticles() {
@@ -1234,14 +1236,14 @@ void CElementGen::RenderParticles() {
if (g_subtractBlend) {
if (moveRedToAlphaBuffer)
CGraphics::SetShaderDataBinding(m_redToAlphaSubDataBind);
CGraphics::SetShaderDataBinding(m_redToAlphaSubDataBind[g_Renderer->IsThermalVisorHotPass()]);
else
CGraphics::SetShaderDataBinding(m_normalSubDataBind);
CGraphics::SetShaderDataBinding(m_normalSubDataBind[g_Renderer->IsThermalVisorHotPass()]);
} else {
if (moveRedToAlphaBuffer)
CGraphics::SetShaderDataBinding(m_redToAlphaDataBind);
CGraphics::SetShaderDataBinding(m_redToAlphaDataBind[g_Renderer->IsThermalVisorHotPass()]);
else
CGraphics::SetShaderDataBinding(m_normalDataBind);
CGraphics::SetShaderDataBinding(m_normalDataBind[g_Renderer->IsThermalVisorHotPass()]);
}
int mbspVal = std::max(1, x270_MBSP);
@@ -1657,7 +1659,7 @@ void CElementGen::RenderParticlesIndirectTexture() {
g_instIndTexData.reserve(x30_particles.size());
if (!x30_particles.empty())
CGraphics::SetShaderDataBinding(m_normalDataBind);
CGraphics::SetShaderDataBinding(m_normalDataBind[g_Renderer->IsThermalVisorHotPass()]);
for (int i = 0; i < x30_particles.size(); ++i) {
int partIdx = desc->x44_28_x30_28_SORT ? sortItems[i].x0_partIdx : i;

View File

@@ -144,15 +144,15 @@ public:
EOptionalSystemFlags flags = EOptionalSystemFlags::One);
~CElementGen();
boo::ObjToken<boo::IShaderDataBinding> m_normalDataBind;
boo::ObjToken<boo::IShaderDataBinding> m_normalSubDataBind;
boo::ObjToken<boo::IShaderDataBinding> m_redToAlphaDataBind;
boo::ObjToken<boo::IShaderDataBinding> m_redToAlphaSubDataBind;
boo::ObjToken<boo::IShaderDataBinding> m_normalDataBind[2];
boo::ObjToken<boo::IShaderDataBinding> m_normalSubDataBind[2];
boo::ObjToken<boo::IShaderDataBinding> m_redToAlphaDataBind[2];
boo::ObjToken<boo::IShaderDataBinding> m_redToAlphaSubDataBind[2];
boo::ObjToken<boo::IGraphicsBufferD> m_instBuf;
boo::ObjToken<boo::IGraphicsBufferD> m_uniformBuf;
boo::ObjToken<boo::IShaderDataBinding> m_normalDataBindPmus;
boo::ObjToken<boo::IShaderDataBinding> m_redToAlphaDataBindPmus;
boo::ObjToken<boo::IShaderDataBinding> m_normalDataBindPmus[2];
boo::ObjToken<boo::IShaderDataBinding> m_redToAlphaDataBindPmus[2];
boo::ObjToken<boo::IGraphicsBufferD> m_instBufPmus;
boo::ObjToken<boo::IGraphicsBufferD> m_uniformBufPmus;

View File

@@ -9,6 +9,8 @@
#include "CParticleGlobals.hpp"
#include "zeus/CRelAngle.hpp"
#include "zeus/CQuaternion.hpp"
#include "GameGlobalObjects.hpp"
#include "Graphics/CBooRenderer.hpp"
namespace urde {
@@ -96,7 +98,7 @@ void CParticleElectric::DrawLineStrip(const std::vector<zeus::CVector3f>& verts,
renderer.Reset();
for (const zeus::CVector3f& vert : verts)
renderer.AddVertex(vert, useColor, width);
renderer.Render();
renderer.Render(g_Renderer->IsThermalVisorHotPass());
}
void CParticleElectric::RenderLines() {

View File

@@ -1,6 +1,8 @@
#include "CParticleSwoosh.hpp"
#include "CSwooshDescription.hpp"
#include "CParticleGlobals.hpp"
#include "GameGlobalObjects.hpp"
#include "Graphics/CBooRenderer.hpp"
#include <chrono>
namespace urde {
@@ -441,7 +443,7 @@ void CParticleSwoosh::RenderNSidedSpline() {
}
if (x1bc_prim == GX::LINES)
m_lineRenderer->Render();
m_lineRenderer->Render(g_Renderer->IsThermalVisorHotPass());
}
void CParticleSwoosh::RenderNSidedNoSpline() { RenderNSidedSpline(); }
@@ -870,8 +872,8 @@ void CParticleSwoosh::Render(const CActorLights*) {
return;
m_cachedVerts.clear();
if (m_dataBind)
CGraphics::SetShaderDataBinding(m_dataBind);
if (m_dataBind[0])
CGraphics::SetShaderDataBinding(m_dataBind[g_Renderer->IsThermalVisorHotPass()]);
CParticleGlobals::SetParticleLifetime(x1b4_LENG);
CGlobalRandom gr(x1c0_rand);

View File

@@ -100,7 +100,7 @@ class CParticleSwoosh : public CParticleGen {
float x208_maxRadius = 0.f;
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_uniformBuf;
std::unique_ptr<CLineRenderer> m_lineRenderer;