mirror of https://github.com/AxioDL/metaforce.git
Initial PVS stubs
This commit is contained in:
parent
8b234fafb8
commit
79443d93d2
|
@ -302,6 +302,17 @@ void CBooRenderer::AddStaticGeometry(const std::vector<CMetroidModelInstance>* g
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CBooRenderer::EnablePVS(const CPVSVisSet* set, u32 modelCount)
|
||||||
|
{
|
||||||
|
xc8_pvs.emplace(*set);
|
||||||
|
xe0_pvsModelCount = modelCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBooRenderer::DisablePVS()
|
||||||
|
{
|
||||||
|
xc8_pvs = std::experimental::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
void CBooRenderer::RemoveStaticGeometry(const std::vector<CMetroidModelInstance>* geometry)
|
void CBooRenderer::RemoveStaticGeometry(const std::vector<CMetroidModelInstance>* geometry)
|
||||||
{
|
{
|
||||||
auto search = FindStaticGeometry(geometry);
|
auto search = FindStaticGeometry(geometry);
|
||||||
|
@ -309,17 +320,91 @@ void CBooRenderer::RemoveStaticGeometry(const std::vector<CMetroidModelInstance>
|
||||||
x1c_areaListItems.erase(search);
|
x1c_areaListItems.erase(search);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBooRenderer::DrawUnsortedGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int)
|
void CBooRenderer::DrawUnsortedGeometry(const std::vector<CLight>&, int mask, int targetMask)
|
||||||
{
|
{
|
||||||
|
//SetupRendererStates(true);
|
||||||
|
|
||||||
|
CAreaListItem* lastOctreeItem = nullptr;
|
||||||
|
|
||||||
|
for (CAreaListItem& item : x1c_areaListItems)
|
||||||
|
{
|
||||||
|
if (item.x18_unk != 0xff)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (item.x4_octTree)
|
||||||
|
lastOctreeItem = &item;
|
||||||
|
|
||||||
|
CPVSVisSet* pvs = nullptr;
|
||||||
|
if (xc8_pvs)
|
||||||
|
pvs = &*xc8_pvs;
|
||||||
|
if (xe0_pvsModelCount != item.x10_models.size())
|
||||||
|
pvs = nullptr;
|
||||||
|
|
||||||
|
int idx = 0;
|
||||||
|
for (auto it = item.x10_models.begin() ; it != item.x10_models.end() ; ++it, ++idx)
|
||||||
|
{
|
||||||
|
CBooModel* model = *it;
|
||||||
|
if (pvs)
|
||||||
|
{
|
||||||
|
bool vis = pvs->GetVisible(idx);
|
||||||
|
switch (xc4_pvsMode)
|
||||||
|
{
|
||||||
|
case EPVSMode::PVS:
|
||||||
|
{
|
||||||
|
if (!vis)
|
||||||
|
{
|
||||||
|
model->x40_25_modelVisible = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case EPVSMode::PVSAndMask:
|
||||||
|
{
|
||||||
|
if (!vis && (model->x41_mask & mask) != targetMask)
|
||||||
|
{
|
||||||
|
model->x40_25_modelVisible = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((model->x41_mask & mask) != targetMask)
|
||||||
|
{
|
||||||
|
model->x40_25_modelVisible = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!x44_frustumPlanes.aabbFrustumTest(model->x20_aabb))
|
||||||
|
{
|
||||||
|
model->x40_25_modelVisible = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x318_25_drawWireframe)
|
||||||
|
{
|
||||||
|
model->x40_25_modelVisible = false;
|
||||||
|
//HandleUnsortedModelWireframe();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
model->x40_25_modelVisible = true;
|
||||||
|
//HandleUnsortedModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//SetupCGraphicsStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBooRenderer::DrawSortedGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int)
|
void CBooRenderer::DrawSortedGeometry(const std::vector<CLight>&, int mask, int targetMask)
|
||||||
{
|
{
|
||||||
//SetupRendererStates();
|
//SetupRendererStates(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBooRenderer::DrawStaticGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int)
|
void CBooRenderer::DrawStaticGeometry(const std::vector<CLight>& lights, int mask, int targetMask)
|
||||||
{
|
{
|
||||||
|
DrawUnsortedGeometry(lights, mask, targetMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBooRenderer::PostRenderFogs()
|
void CBooRenderer::PostRenderFogs()
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "CDrawablePlaneObject.hpp"
|
#include "CDrawablePlaneObject.hpp"
|
||||||
#include "Shaders/CThermalColdFilter.hpp"
|
#include "Shaders/CThermalColdFilter.hpp"
|
||||||
#include "CRandom16.hpp"
|
#include "CRandom16.hpp"
|
||||||
|
#include "CPVSVisSet.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
@ -71,6 +72,15 @@ class CBooRenderer : public IRenderer
|
||||||
|
|
||||||
zeus::CPlane xb0_ = {0.f, 1.f, 0.f, 0.f};
|
zeus::CPlane xb0_ = {0.f, 1.f, 0.f, 0.f};
|
||||||
|
|
||||||
|
enum class EPVSMode
|
||||||
|
{
|
||||||
|
Mask,
|
||||||
|
PVS,
|
||||||
|
PVSAndMask
|
||||||
|
} xc4_pvsMode = EPVSMode::Mask;
|
||||||
|
std::experimental::optional<CPVSVisSet> xc8_pvs;
|
||||||
|
u32 xe0_pvsModelCount = 0;
|
||||||
|
|
||||||
//boo::ITextureS* xe4_blackTex = nullptr;
|
//boo::ITextureS* xe4_blackTex = nullptr;
|
||||||
bool xee_24_ : 1;
|
bool xee_24_ : 1;
|
||||||
|
|
||||||
|
@ -96,7 +106,7 @@ class CBooRenderer : public IRenderer
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bool x318_24_refectionDirty : 1;
|
bool x318_24_refectionDirty : 1;
|
||||||
bool x318_25_ : 1;
|
bool x318_25_drawWireframe : 1;
|
||||||
bool x318_26_ : 1;
|
bool x318_26_ : 1;
|
||||||
bool x318_27_ : 1;
|
bool x318_27_ : 1;
|
||||||
bool x318_28_ : 1;
|
bool x318_28_ : 1;
|
||||||
|
@ -121,10 +131,12 @@ public:
|
||||||
|
|
||||||
std::list<CAreaListItem>::iterator FindStaticGeometry(const std::vector<CMetroidModelInstance>*);
|
std::list<CAreaListItem>::iterator FindStaticGeometry(const std::vector<CMetroidModelInstance>*);
|
||||||
void AddStaticGeometry(const std::vector<CMetroidModelInstance>*, const CAreaOctTree*, int);
|
void AddStaticGeometry(const std::vector<CMetroidModelInstance>*, const CAreaOctTree*, int);
|
||||||
|
void EnablePVS(const CPVSVisSet*, u32);
|
||||||
|
void DisablePVS();
|
||||||
void RemoveStaticGeometry(const std::vector<CMetroidModelInstance>*);
|
void RemoveStaticGeometry(const std::vector<CMetroidModelInstance>*);
|
||||||
void DrawUnsortedGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int);
|
void DrawUnsortedGeometry(const std::vector<CLight>&, int mask, int targetMask);
|
||||||
void DrawSortedGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int);
|
void DrawSortedGeometry(const std::vector<CLight>&, int mask, int targetMask);
|
||||||
void DrawStaticGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int);
|
void DrawStaticGeometry(const std::vector<CLight>&, int mask, int targetMask);
|
||||||
void PostRenderFogs();
|
void PostRenderFogs();
|
||||||
void AddParticleGen(const CParticleGen&);
|
void AddParticleGen(const CParticleGen&);
|
||||||
void AddPlaneObject(const void*, const zeus::CAABox&, const zeus::CPlane&, int);
|
void AddPlaneObject(const void*, const zeus::CAABox&, const zeus::CPlane&, int);
|
||||||
|
|
|
@ -20,6 +20,10 @@ set(GRAPHICS_SOURCES
|
||||||
CMoviePlayer.hpp CMoviePlayer.cpp
|
CMoviePlayer.hpp CMoviePlayer.cpp
|
||||||
CFrustumPlanes.hpp CFrustumPlanes.cpp
|
CFrustumPlanes.hpp CFrustumPlanes.cpp
|
||||||
CGraphicsPalette.hpp CGraphicsPalette.cpp
|
CGraphicsPalette.hpp CGraphicsPalette.cpp
|
||||||
|
CPVSVisSet.hpp CPVSVisSet.cpp
|
||||||
|
CPVSVisOctree.hpp CPVSVisOctree.cpp
|
||||||
|
CPVSBounds.hpp CPVSBounds.cpp
|
||||||
|
CPVSAreaSet.hpp CPVSAreaSet.cpp
|
||||||
CGraphics.hpp CGraphics.cpp
|
CGraphics.hpp CGraphics.cpp
|
||||||
Shaders/TShader.hpp Shaders/TShaderDecl.hpp
|
Shaders/TShader.hpp Shaders/TShaderDecl.hpp
|
||||||
Shaders/CLineRendererShaders.hpp Shaders/CLineRendererShaders.cpp Shaders/CLineRendererShadersGLSL.cpp
|
Shaders/CLineRendererShaders.hpp Shaders/CLineRendererShaders.cpp Shaders/CLineRendererShadersGLSL.cpp
|
||||||
|
|
|
@ -84,7 +84,8 @@ private:
|
||||||
CBooSurface* x38_firstUnsortedSurface = nullptr;
|
CBooSurface* x38_firstUnsortedSurface = nullptr;
|
||||||
CBooSurface* x3c_firstSortedSurface = nullptr;
|
CBooSurface* x3c_firstSortedSurface = nullptr;
|
||||||
bool x40_24_texturesLoaded : 1;
|
bool x40_24_texturesLoaded : 1;
|
||||||
bool x40_25_ : 1;
|
bool x40_25_modelVisible : 1;
|
||||||
|
u8 x41_mask = 0;
|
||||||
|
|
||||||
struct UVAnimationBuffer
|
struct UVAnimationBuffer
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,7 @@ CBooModel::CBooModel(std::vector<CBooSurface>* surfaces, SShader& shader,
|
||||||
: x0_surfaces(surfaces), x4_matSet(&shader.m_matSet), m_pipelines(&shader.m_shaders),
|
: x0_surfaces(surfaces), x4_matSet(&shader.m_matSet), m_pipelines(&shader.m_shaders),
|
||||||
m_vtxFmt(vtxFmt), x8_vbo(vbo), xc_ibo(ibo), m_weightVecCount(weightVecCount),
|
m_vtxFmt(vtxFmt), x8_vbo(vbo), xc_ibo(ibo), m_weightVecCount(weightVecCount),
|
||||||
m_skinBankCount(skinBankCount), x1c_textures(&shader.x0_textures), x20_aabb(aabb),
|
m_skinBankCount(skinBankCount), x1c_textures(&shader.x0_textures), x20_aabb(aabb),
|
||||||
x40_24_texturesLoaded(false), x40_25_(0)
|
x40_24_texturesLoaded(false), x40_25_modelVisible(0)
|
||||||
{
|
{
|
||||||
for (CBooSurface& surf : *x0_surfaces)
|
for (CBooSurface& surf : *x0_surfaces)
|
||||||
surf.m_parent = this;
|
surf.m_parent = this;
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
#include "CPVSAreaSet.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
CPVSAreaSet::CPVSAreaSet(CInputStream& in)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef __URDE_CPVSAREASET_HPP__
|
||||||
|
#define __URDE_CPVSAREASET_HPP__
|
||||||
|
|
||||||
|
#include "RetroTypes.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
class CPVSAreaSet
|
||||||
|
{
|
||||||
|
struct CPVSAreaHolder
|
||||||
|
{
|
||||||
|
CPVSAreaHolder(CInputStream& in);
|
||||||
|
};
|
||||||
|
std::vector<CPVSAreaHolder> xunk;
|
||||||
|
public:
|
||||||
|
CPVSAreaSet(CInputStream& in);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __URDE_CPVSAREASET_HPP__
|
|
@ -0,0 +1,18 @@
|
||||||
|
#include "CPVSBounds.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
CPVSBounds::CPVSBounds(CInputStream& in)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 CPVSBounds::GetBoundsFileSize()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CPVSBounds::PointInBounds(const zeus::CVector3f&) const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
#ifndef __URDE_CPVSBOUNDS_HPP__
|
||||||
|
#define __URDE_CPVSBOUNDS_HPP__
|
||||||
|
|
||||||
|
#include "RetroTypes.hpp"
|
||||||
|
#include "zeus/CVector3f.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
class CPVSBounds
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CPVSBounds(CInputStream& in);
|
||||||
|
u32 GetBoundsFileSize();
|
||||||
|
bool PointInBounds(const zeus::CVector3f&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __URDE_CPVSBOUNDS_HPP__
|
|
@ -0,0 +1,25 @@
|
||||||
|
#include "CPVSVisOctree.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
CPVSVisOctree::CPVSVisOctree(CInputStream& in)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 CPVSVisOctree::GetNumChildren(const unsigned char*) const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 CPVSVisOctree::GetChildIndex(const unsigned char*, const zeus::CVector3f&) const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 CPVSVisOctree::SetTestPoint(const zeus::CVector3f&) const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
#ifndef __URDE_CPVSVISOCTREE_HPP__
|
||||||
|
#define __URDE_CPVSVISOCTREE_HPP__
|
||||||
|
|
||||||
|
#include "RetroTypes.hpp"
|
||||||
|
#include "zeus/CVector3f.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
class CPVSVisOctree
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CPVSVisOctree(CInputStream& in);
|
||||||
|
u32 GetNumChildren(const unsigned char*) const;
|
||||||
|
u32 GetChildIndex(const unsigned char*, const zeus::CVector3f&) const;
|
||||||
|
u32 SetTestPoint(const zeus::CVector3f&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __URDE_CPVSVISOCTREE_HPP__
|
|
@ -0,0 +1,23 @@
|
||||||
|
#include "CPVSVisSet.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
void CPVSVisSet::Reset(bool)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CPVSVisSet::GetVisible(int)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPVSVisSet::SetVisible(int,bool)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPVSVisSet::SetFromMemory(const unsigned char*)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
#ifndef __URDE_CPVSVISSET_HPP__
|
||||||
|
#define __URDE_CPVSVISSET_HPP__
|
||||||
|
|
||||||
|
#include "RetroTypes.hpp"
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
class CPVSVisSet
|
||||||
|
{
|
||||||
|
int x0_bitCount;
|
||||||
|
int x4_setCount = 0;
|
||||||
|
std::vector<unsigned char> x8_bitset;
|
||||||
|
public:
|
||||||
|
CPVSVisSet(int count) : x0_bitCount(count) {}
|
||||||
|
CPVSVisSet(int a, std::vector<unsigned char>&& bitset)
|
||||||
|
: x0_bitCount(1), x4_setCount(a), x8_bitset(std::move(bitset)) {}
|
||||||
|
void Reset(bool);
|
||||||
|
bool GetVisible(int);
|
||||||
|
void SetVisible(int,bool);
|
||||||
|
void SetFromMemory(const unsigned char*);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __URDE_CPVSVISSET_HPP__
|
|
@ -17,6 +17,7 @@ class CAreaOctTree;
|
||||||
class CParticleGen;
|
class CParticleGen;
|
||||||
class CModel;
|
class CModel;
|
||||||
class CSkinnedModel;
|
class CSkinnedModel;
|
||||||
|
class CPVSVisSet;
|
||||||
|
|
||||||
class IRenderer
|
class IRenderer
|
||||||
{
|
{
|
||||||
|
@ -41,10 +42,12 @@ public:
|
||||||
|
|
||||||
virtual ~IRenderer() = default;
|
virtual ~IRenderer() = default;
|
||||||
virtual void AddStaticGeometry(const std::vector<CMetroidModelInstance>*, const CAreaOctTree*, int)=0;
|
virtual void AddStaticGeometry(const std::vector<CMetroidModelInstance>*, const CAreaOctTree*, int)=0;
|
||||||
|
virtual void EnablePVS(const CPVSVisSet*, u32)=0;
|
||||||
|
virtual void DisablePVS()=0;
|
||||||
virtual void RemoveStaticGeometry(const std::vector<CMetroidModelInstance>*)=0;
|
virtual void RemoveStaticGeometry(const std::vector<CMetroidModelInstance>*)=0;
|
||||||
virtual void DrawUnsortedGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int)=0;
|
virtual void DrawUnsortedGeometry(const std::vector<CLight>&, int, int)=0;
|
||||||
virtual void DrawSortedGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int)=0;
|
virtual void DrawSortedGeometry(const std::vector<CLight>&, int, int)=0;
|
||||||
virtual void DrawStaticGeometry(const std::vector<CLight>&, int, unsigned int, unsigned int)=0;
|
virtual void DrawStaticGeometry(const std::vector<CLight>&, int, int)=0;
|
||||||
virtual void PostRenderFogs()=0;
|
virtual void PostRenderFogs()=0;
|
||||||
virtual void AddParticleGen(const CParticleGen&)=0;
|
virtual void AddParticleGen(const CParticleGen&)=0;
|
||||||
virtual void AddPlaneObject(const void*, const zeus::CAABox&, const zeus::CPlane&, int)=0;
|
virtual void AddPlaneObject(const void*, const zeus::CAABox&, const zeus::CPlane&, int)=0;
|
||||||
|
|
Loading…
Reference in New Issue