mirror of
https://github.com/aimrebirth/tools.git
synced 2026-04-15 01:43:25 +00:00
Extract light, heavy and rocket weapons.
This commit is contained in:
parent
10c9a85358
commit
5f7c59e2eb
2 changed files with 46 additions and 22 deletions
|
|
@ -227,21 +227,17 @@ bool CreateScene(model &model, const std::string &name, FbxManager* pSdkManager,
|
||||||
static const char* gAmbientElementName = "AmbientUV";
|
static const char* gAmbientElementName = "AmbientUV";
|
||||||
static const char* gSpecularElementName = "SpecularUV";
|
static const char* gSpecularElementName = "SpecularUV";
|
||||||
|
|
||||||
//std::map<std::string,
|
auto create_socket_named = [&pScene](const std::string &name)
|
||||||
int socket_id = 0;
|
|
||||||
for (auto &b : model.blocks)
|
|
||||||
{
|
{
|
||||||
if (!b.canPrint())
|
FbxNode *socket = FbxNode::Create(pScene, ("SOCKET_" + name).c_str());
|
||||||
continue;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (b.isEngineFx())
|
|
||||||
{
|
|
||||||
FbxNode *socket = FbxNode::Create(pScene, std::string("SOCKET_EngineFx_" + std::to_string(socket_id++)).c_str());
|
|
||||||
auto n = FbxNull::Create(socket, "");
|
auto n = FbxNull::Create(socket, "");
|
||||||
socket->SetNodeAttribute(n);
|
socket->SetNodeAttribute(n);
|
||||||
pScene->GetRootNode()->AddChild(socket);
|
pScene->GetRootNode()->AddChild(socket);
|
||||||
|
return socket;
|
||||||
|
};
|
||||||
|
|
||||||
|
auto create_socket = [&create_socket_named](const auto &b, const std::string &name, bool mirror_x = false)
|
||||||
|
{
|
||||||
FbxVector4 c;
|
FbxVector4 c;
|
||||||
for (auto &v : b.vertices)
|
for (auto &v : b.vertices)
|
||||||
{
|
{
|
||||||
|
|
@ -251,10 +247,41 @@ bool CreateScene(model &model, const std::string &name, FbxManager* pSdkManager,
|
||||||
}
|
}
|
||||||
c /= b.vertices.size();
|
c /= b.vertices.size();
|
||||||
|
|
||||||
socket->LclTranslation.Set(c);
|
auto s = create_socket_named(name);
|
||||||
|
if (mirror_x)
|
||||||
|
c.mData[0] = -c.mData[0];
|
||||||
|
s->LclTranslation.Set(c);
|
||||||
|
};
|
||||||
|
|
||||||
|
//std::map<std::string,
|
||||||
|
int socket_id = 0;
|
||||||
|
for (auto &b : model.blocks)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (b.isEngineFx())
|
||||||
|
{
|
||||||
|
create_socket(b, "EngineFx_" + std::to_string(socket_id++));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (b.h.name == "LIGHTGUN")
|
||||||
|
{
|
||||||
|
create_socket(b, "WeaponLight_0");
|
||||||
|
create_socket(b, "WeaponLight_1", true);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (b.h.name == "HEAVYGUN")
|
||||||
|
{
|
||||||
|
create_socket(b, "WeaponHeavy");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (b.h.name == "ROCKET")
|
||||||
|
{
|
||||||
|
create_socket(b, "WeaponRocket");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!b.canPrint())
|
||||||
|
continue;
|
||||||
|
|
||||||
//auto block_name = name + "/" + b.h.name;
|
//auto block_name = name + "/" + b.h.name;
|
||||||
const auto block_name = b.h.name;
|
const auto block_name = b.h.name;
|
||||||
|
|
|
||||||
|
|
@ -472,9 +472,6 @@ bool block::canPrint() const
|
||||||
if (h.type == BlockType::VisibleObject)
|
if (h.type == BlockType::VisibleObject)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (isEngineFx())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// particles
|
// particles
|
||||||
if (h.type == BlockType::ParticleEmitter)
|
if (h.type == BlockType::ParticleEmitter)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue