mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-06-09 18:33:29 +00:00
VISIGen linux fixes
This commit is contained in:
parent
7bbf8852de
commit
e0e966b241
@ -28,7 +28,7 @@ EPVSVisSetState CPVSVisSet::GetVisible(u32 idx) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* This is a light lookup */
|
/* This is a light lookup */
|
||||||
u32 lightTest = idx - numFeatures + x4_numBits;
|
u32 lightTest = idx - numFeatures + idx;
|
||||||
const u8* ptr = &x10_ptr[lightTest / 8];
|
const u8* ptr = &x10_ptr[lightTest / 8];
|
||||||
lightTest &= 0x7;
|
lightTest &= 0x7;
|
||||||
if (lightTest != 0x7)
|
if (lightTest != 0x7)
|
||||||
|
@ -287,7 +287,15 @@ int main(int argc, const char** argv)
|
|||||||
|
|
||||||
renderer.Run(UpdatePercent);
|
renderer.Run(UpdatePercent);
|
||||||
clientRunning = false;
|
clientRunning = false;
|
||||||
pthread_kill(mainThread, SIGUSR2);
|
|
||||||
|
XLockDisplay(xDisp);
|
||||||
|
XClientMessageEvent exitEvent = {};
|
||||||
|
exitEvent.type = ClientMessage;
|
||||||
|
exitEvent.window = windowId;
|
||||||
|
exitEvent.format = 32;
|
||||||
|
XSendEvent(xDisp, windowId, 0, 0, (XEvent*)&exitEvent);
|
||||||
|
XFlush(xDisp);
|
||||||
|
XUnlockDisplay(xDisp);
|
||||||
});
|
});
|
||||||
initcv.wait(outerLk);
|
initcv.wait(outerLk);
|
||||||
|
|
||||||
@ -317,9 +325,11 @@ int main(int argc, const char** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("Joining\n");
|
||||||
renderer.Terminate();
|
renderer.Terminate();
|
||||||
if (clientThread.joinable())
|
if (clientThread.joinable())
|
||||||
clientThread.join();
|
clientThread.join();
|
||||||
|
|
||||||
|
printf("Returning\n");
|
||||||
return renderer.ReturnVal();
|
return renderer.ReturnVal();
|
||||||
}
|
}
|
||||||
|
@ -203,8 +203,9 @@ static const int NumChildTable[] =
|
|||||||
void VISIBuilder::Node::calculateSizesAndOffs(size_t& cur, size_t leafSz)
|
void VISIBuilder::Node::calculateSizesAndOffs(size_t& cur, size_t leafSz)
|
||||||
{
|
{
|
||||||
cur += 1;
|
cur += 1;
|
||||||
|
flags |= 0x18;
|
||||||
|
|
||||||
if (flags)
|
if (flags & 0x7)
|
||||||
{
|
{
|
||||||
int splits[3];
|
int splits[3];
|
||||||
splits[0] = (flags & 0x1) ? 2 : 1;
|
splits[0] = (flags & 0x1) ? 2 : 1;
|
||||||
@ -245,7 +246,6 @@ void VISIBuilder::Node::calculateSizesAndOffs(size_t& cur, size_t leafSz)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
cur += leafSz;
|
cur += leafSz;
|
||||||
flags |= 0x18;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +309,7 @@ std::vector<uint8_t> VISIBuilder::build(const zeus::CAABox& fullAabb,
|
|||||||
Log.report(logvisor::Info, "Started!");
|
Log.report(logvisor::Info, "Started!");
|
||||||
|
|
||||||
size_t featureCount = modelCount + entities.size();
|
size_t featureCount = modelCount + entities.size();
|
||||||
renderCache.m_lightMetaBit = featureCount + lights.size();
|
renderCache.m_lightMetaBit = featureCount;
|
||||||
|
|
||||||
Progress prog(updatePercent);
|
Progress prog(updatePercent);
|
||||||
bool& terminate = renderCache.m_renderer.m_terminate;
|
bool& terminate = renderCache.m_renderer.m_terminate;
|
||||||
@ -318,13 +318,12 @@ std::vector<uint8_t> VISIBuilder::build(const zeus::CAABox& fullAabb,
|
|||||||
return {};
|
return {};
|
||||||
|
|
||||||
// Lights cache their CPVSVisSet result enum as 2 bits
|
// Lights cache their CPVSVisSet result enum as 2 bits
|
||||||
size_t leafBitsCount = featureCount + lights.size() * 3;
|
size_t leafBitsCount = featureCount + lights.size() * 2;
|
||||||
size_t leafBytesCount = ROUND_UP_8(leafBitsCount) / 8;
|
size_t leafBytesCount = ROUND_UP_8(leafBitsCount) / 8;
|
||||||
|
|
||||||
// Calculate octree size and store relative offsets
|
// Calculate octree size and store relative offsets
|
||||||
size_t octreeSz = 0;
|
size_t octreeSz = 0;
|
||||||
rootNode.calculateSizesAndOffs(octreeSz, leafBytesCount);
|
rootNode.calculateSizesAndOffs(octreeSz, leafBytesCount);
|
||||||
octreeSz += 1; // Terminator node
|
|
||||||
|
|
||||||
size_t visiSz = 34 + entities.size() * 4 + lights.size() * leafBytesCount + 36 + octreeSz;
|
size_t visiSz = 34 + entities.size() * 4 + lights.size() * leafBytesCount + 36 + octreeSz;
|
||||||
size_t roundedVisiSz = ROUND_UP_32(visiSz);
|
size_t roundedVisiSz = ROUND_UP_32(visiSz);
|
||||||
@ -355,11 +354,10 @@ std::vector<uint8_t> VISIBuilder::build(const zeus::CAABox& fullAabb,
|
|||||||
|
|
||||||
w.writeVec3fBig(fullAabb.min);
|
w.writeVec3fBig(fullAabb.min);
|
||||||
w.writeVec3fBig(fullAabb.max);
|
w.writeVec3fBig(fullAabb.max);
|
||||||
w.writeUint32Big(leafBitsCount);
|
w.writeUint32Big(featureCount + lights.size());
|
||||||
w.writeUint32Big(lights.size());
|
w.writeUint32Big(lights.size());
|
||||||
w.writeUint32Big(octreeSz);
|
w.writeUint32Big(octreeSz);
|
||||||
rootNode.writeNodes(w, leafBytesCount);
|
rootNode.writeNodes(w, leafBytesCount);
|
||||||
w.writeUByte(0x10);
|
|
||||||
|
|
||||||
w.seekAlign32();
|
w.seekAlign32();
|
||||||
|
|
||||||
|
@ -415,7 +415,6 @@ void VISIRenderer::RenderPVSEntitiesAndLights(const std::function<void(int)>& pa
|
|||||||
{
|
{
|
||||||
if (!frustum.pointFrustumTest(light.point))
|
if (!frustum.pointFrustumTest(light.point))
|
||||||
{
|
{
|
||||||
++idx;
|
|
||||||
++lightIdx;
|
++lightIdx;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -427,14 +426,9 @@ void VISIRenderer::RenderPVSEntitiesAndLights(const std::function<void(int)>& pa
|
|||||||
glGetQueryObjectiv(m_query, GL_QUERY_RESULT, &res);
|
glGetQueryObjectiv(m_query, GL_QUERY_RESULT, &res);
|
||||||
EPVSVisSetState state = m_totalAABB.pointInside(light.point) ?
|
EPVSVisSetState state = m_totalAABB.pointInside(light.point) ?
|
||||||
EPVSVisSetState::EndOfTree : EPVSVisSetState::OutOfBounds;
|
EPVSVisSetState::EndOfTree : EPVSVisSetState::OutOfBounds;
|
||||||
if (res)
|
if (res && state == EPVSVisSetState::EndOfTree)
|
||||||
{
|
state = EPVSVisSetState::NodeFound;
|
||||||
passFunc(idx);
|
|
||||||
if (state == EPVSVisSetState::EndOfTree)
|
|
||||||
state = EPVSVisSetState::NodeFound;
|
|
||||||
}
|
|
||||||
lightPassFunc(lightIdx, state);
|
lightPassFunc(lightIdx, state);
|
||||||
++idx;
|
|
||||||
++lightIdx;
|
++lightIdx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user