mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 17:47:43 +00:00
Implement non-rippling CFluidPlaneCPU render path
This commit is contained in:
@@ -178,7 +178,8 @@ CFluidPlaneShader::CFluidPlaneShader(CFluidPlane::EFluidType type,
|
||||
}
|
||||
|
||||
void CFluidPlaneShader::draw(const zeus::CMatrix4f texMtxs[6], const zeus::CMatrix4f& normMtx, float indScale,
|
||||
const std::vector<CLight>& lights, const zeus::CColor kColors[4])
|
||||
const std::vector<CLight>& lights, const zeus::CColor kColors[4],
|
||||
const std::vector<Vertex>& verts)
|
||||
{
|
||||
Uniform& uni = *reinterpret_cast<Uniform*>(m_uniBuf->map(sizeof(Uniform)));
|
||||
uni.m_mv = CGraphics::g_GXModelView.toMatrix4f();
|
||||
@@ -192,8 +193,11 @@ void CFluidPlaneShader::draw(const zeus::CMatrix4f texMtxs[6], const zeus::CMatr
|
||||
uni.m_lighting.mulColor = kColors[3];
|
||||
uni.m_lighting.fog.m_rangeScale = indScale;
|
||||
m_uniBuf->unmap();
|
||||
|
||||
m_vbo->load(verts.data(), verts.size() * sizeof(Vertex));
|
||||
|
||||
CGraphics::SetShaderDataBinding(m_dataBind);
|
||||
CGraphics::DrawArray(0, 0);
|
||||
CGraphics::DrawArray(0, verts.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,6 +37,29 @@ struct SFluidPlaneShaderInfo
|
||||
|
||||
class CFluidPlaneShader
|
||||
{
|
||||
public:
|
||||
struct Vertex
|
||||
{
|
||||
zeus::CVector3f m_pos;
|
||||
zeus::CVector3f m_norm;
|
||||
zeus::CVector3f m_binorm;
|
||||
zeus::CVector3f m_tangent;
|
||||
zeus::CColor m_color;
|
||||
|
||||
Vertex() = default;
|
||||
Vertex(const zeus::CVector3f& position) : m_pos(position) {}
|
||||
Vertex(const zeus::CVector3f& position, const zeus::CColor& color)
|
||||
: m_pos(position), m_color(color) {}
|
||||
Vertex(const zeus::CVector3f& position, const zeus::CVector3f& normal,
|
||||
const zeus::CColor& color)
|
||||
: m_pos(position), m_norm(normal), m_color(color) {}
|
||||
Vertex(const zeus::CVector3f& position, const zeus::CVector3f& normal,
|
||||
const zeus::CVector3f& binormal, const zeus::CVector3f& tangent,
|
||||
const zeus::CColor& color)
|
||||
: m_pos(position), m_norm(normal), m_binorm(binormal), m_tangent(tangent), m_color(color) {}
|
||||
};
|
||||
|
||||
private:
|
||||
class Cache
|
||||
{
|
||||
std::pair<boo::GraphicsDataToken, boo::IShaderPipeline*> m_cache[1024] = {};
|
||||
@@ -46,15 +69,6 @@ class CFluidPlaneShader
|
||||
};
|
||||
static Cache _cache;
|
||||
|
||||
struct Vertex
|
||||
{
|
||||
zeus::CVector3f m_pos;
|
||||
zeus::CVector3f m_norm;
|
||||
zeus::CVector3f m_binorm;
|
||||
zeus::CVector3f m_tangent;
|
||||
zeus::CColor m_color;
|
||||
};
|
||||
|
||||
struct Uniform
|
||||
{
|
||||
zeus::CMatrix4f m_mv;
|
||||
@@ -102,7 +116,8 @@ public:
|
||||
const std::experimental::optional<TLockedToken<CTexture>>& lightmap,
|
||||
bool doubleLightmapBlend, bool additive);
|
||||
void draw(const zeus::CMatrix4f texMtxs[6], const zeus::CMatrix4f& normMtx, float indScale,
|
||||
const std::vector<CLight>& lights, const zeus::CColor kColors[4]);
|
||||
const std::vector<CLight>& lights, const zeus::CColor kColors[4],
|
||||
const std::vector<Vertex>& verts);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user