HMDL buffer sharing fix

This commit is contained in:
Jack Andersen 2016-09-09 19:38:18 -10:00
parent 3438cb34a3
commit 7cc0ac7902
3 changed files with 17 additions and 13 deletions

View File

@ -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)

View File

@ -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

View File

@ -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;