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

CScriptMidi and work on CGameArea loading

This commit is contained in:
Jack Andersen
2017-02-26 19:25:14 -10:00
parent 628e5b41df
commit e923d83617
28 changed files with 446 additions and 112 deletions

View File

@@ -4,7 +4,6 @@
#define VISI_MIN_LENGTH 8.0
static logvisor::Module Log("VISIBuilder");
const VISIBuilder::Leaf VISIBuilder::NullLeaf = {};
VISIBuilder::PVSRenderCache::PVSRenderCache(VISIRenderer& renderer)
: m_renderer(renderer)
@@ -245,7 +244,10 @@ void VISIBuilder::Node::calculateSizesAndOffs(size_t& cur, size_t leafSz)
}
else
{
cur += leafSz;
if (!leaf)
flags &= ~0x8;
else
cur += leafSz;
}
}
@@ -294,7 +296,7 @@ void VISIBuilder::Node::writeNodes(athena::io::MemoryWriter& w, size_t leafBytes
childNodes[nodeSel].writeNodes(w, leafBytes);
}
}
else
else if (leaf)
{
leaf.write(w, leafBytes);
}

View File

@@ -77,7 +77,6 @@ struct VISIBuilder
}
}
};
static const Leaf NullLeaf;
class PVSRenderCache
{
@@ -113,7 +112,7 @@ struct VISIBuilder
bool operator==(const Node& other) const
{
if (!leaf || !other.leaf)
if ((flags & 0x7) || (other.flags & 0x7))
return false;
return leaf == other.leaf;
}

View File

@@ -296,6 +296,10 @@ void VISIRenderer::RenderPVSOpaque(RGBA8* bufOut, const zeus::CVector3f& pos, bo
zeus::CFrustum frustum;
frustum.updatePlanes(mv, g_Proj);
// Fill depth buffer with backfaces initially
glCullFace(GL_FRONT);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
for (const Model& model : m_models)
{
if (!frustum.aabbFrustumTest(model.aabb))
@@ -311,6 +315,24 @@ void VISIRenderer::RenderPVSOpaque(RGBA8* bufOut, const zeus::CVector3f& pos, bo
needTransparent = true;
}
}
// Draw frontfaces
glCullFace(GL_BACK);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
for (const Model& model : m_models)
{
if (!frustum.aabbFrustumTest(model.aabb))
continue;
glBindVertexArray(model.vao);
for (const Model::Surface& surf : model.surfaces)
{
// Non-transparents first
if (!surf.transparent)
glDrawElements(model.topology, surf.count, GL_UNSIGNED_INT,
reinterpret_cast<void*>(uintptr_t(surf.first * 4)));
}
}
}
//m_swapFunc();