mirror of https://github.com/AxioDL/metaforce.git
HMDL buffer sharing fix
This commit is contained in:
parent
3438cb34a3
commit
7cc0ac7902
|
@ -587,6 +587,21 @@ void BlenderConnection::PyOutStream::linkBackground(const char* target,
|
|||
sceneName, sceneName, target, sceneName);
|
||||
}
|
||||
|
||||
void BlenderConnection::DataStream::Mesh::normalizeSkinBinds()
|
||||
{
|
||||
for (std::vector<SkinBind>& skin : skins)
|
||||
{
|
||||
float accum = 0.f;
|
||||
for (const SkinBind& bind : skin)
|
||||
accum += bind.weight;
|
||||
if (accum > FLT_EPSILON)
|
||||
{
|
||||
for (SkinBind& bind : skin)
|
||||
bind.weight /= accum;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BlenderConnection::DataStream::Mesh::Mesh
|
||||
(BlenderConnection& conn, HMDLTopology topologyIn, int skinSlotCount, SurfProgFunc& surfProg)
|
||||
: topology(topologyIn), sceneXf(conn), aabbMin(conn), aabbMax(conn)
|
||||
|
|
|
@ -431,18 +431,7 @@ public:
|
|||
std::vector<std::vector<SkinBind>> skins;
|
||||
std::vector<size_t> contiguousSkinVertCounts;
|
||||
|
||||
void normalizeSkinBinds()
|
||||
{
|
||||
for (std::vector<SkinBind>& skin : skins)
|
||||
{
|
||||
float accum = 0.f;
|
||||
for (const SkinBind& bind : skin)
|
||||
accum += bind.weight;
|
||||
if (accum > FLT_EPSILON)
|
||||
for (SkinBind& bind : skin)
|
||||
bind.weight /= accum;
|
||||
}
|
||||
}
|
||||
void normalizeSkinBinds();
|
||||
|
||||
/** Islands of the same material/skinBank are represented here */
|
||||
struct Surface
|
||||
|
|
|
@ -68,7 +68,7 @@ HMDLBuffers BlenderConnection::DataStream::Mesh::getHMDLBuffers(bool absoluteCoo
|
|||
bool found = false;
|
||||
for (const std::pair<const Surface*, const Surface::Vert*>& tv : vertPool)
|
||||
{
|
||||
if (v == *tv.second)
|
||||
if (v == *tv.second && surf.skinBankIdx == tv.first->skinBankIdx)
|
||||
{
|
||||
iboData.push_back(ti);
|
||||
found = true;
|
||||
|
|
Loading…
Reference in New Issue