|
@@ -189,7 +189,7 @@ static void writeNodeTransform(const Exporter& exporter, std::ofstream& file,
|
|
|
pos[1] = m[1][3];
|
|
pos[1] = m[1][3];
|
|
|
pos[2] = m[2][3];
|
|
pos[2] = m[2][3];
|
|
|
|
|
|
|
|
- file << "local pos = Vec4.new()\n";
|
|
|
|
|
|
|
+ file << "pos = Vec4.new()\n";
|
|
|
file << "pos:setX(" << pos[0] << ")\n";
|
|
file << "pos:setX(" << pos[0] << ")\n";
|
|
|
file << "pos:setY(" << pos[1] << ")\n";
|
|
file << "pos:setY(" << pos[1] << ")\n";
|
|
|
file << "pos:setZ(" << pos[2] << ")\n";
|
|
file << "pos:setZ(" << pos[2] << ")\n";
|
|
@@ -197,7 +197,7 @@ static void writeNodeTransform(const Exporter& exporter, std::ofstream& file,
|
|
|
file << node
|
|
file << node
|
|
|
<< ":getSceneNodeBase():getMoveComponent():setLocalOrigin(pos)\n";
|
|
<< ":getSceneNodeBase():getMoveComponent():setLocalOrigin(pos)\n";
|
|
|
|
|
|
|
|
- file << "local rot = Mat3x4.new()\n";
|
|
|
|
|
|
|
+ file << "rot = Mat3x4.new()\n";
|
|
|
for(unsigned j = 0; j < 3; j++)
|
|
for(unsigned j = 0; j < 3; j++)
|
|
|
{
|
|
{
|
|
|
for(unsigned i = 0; i < 3; i++)
|
|
for(unsigned i = 0; i < 3; i++)
|
|
@@ -225,7 +225,11 @@ static void exportScene(Exporter& exporter)
|
|
|
std::ofstream file;
|
|
std::ofstream file;
|
|
|
file.open(exporter.outDir + "scene.lua");
|
|
file.open(exporter.outDir + "scene.lua");
|
|
|
|
|
|
|
|
- file << "local scene = getSceneGraph()\n";
|
|
|
|
|
|
|
+ file << "local scene = getSceneGraph()\n"
|
|
|
|
|
+ << "local pos\n"
|
|
|
|
|
+ << "local rot\n"
|
|
|
|
|
+ << "local node\n"
|
|
|
|
|
+ << "local inst\n";
|
|
|
|
|
|
|
|
//
|
|
//
|
|
|
// Get all the data
|
|
// Get all the data
|
|
@@ -254,7 +258,7 @@ static void exportScene(Exporter& exporter)
|
|
|
std::string name = getModelName(exporter, model);
|
|
std::string name = getModelName(exporter, model);
|
|
|
|
|
|
|
|
// Write the main node
|
|
// Write the main node
|
|
|
- file << "\nlocal node = scene:newModelNode(\""
|
|
|
|
|
|
|
+ file << "\nnode = scene:newModelNode(\""
|
|
|
<< name << "\", \""
|
|
<< name << "\", \""
|
|
|
<< exporter.rpath << name << ".ankimdl" << "\")\n";
|
|
<< exporter.rpath << name << ".ankimdl" << "\")\n";
|
|
|
writeNodeTransform(exporter, file, "node", node.transforms[0]);
|
|
writeNodeTransform(exporter, file, "node", node.transforms[0]);
|
|
@@ -262,7 +266,7 @@ static void exportScene(Exporter& exporter)
|
|
|
// Write instance nodes
|
|
// Write instance nodes
|
|
|
for(unsigned j = 1; j < node.transforms.size(); j++)
|
|
for(unsigned j = 1; j < node.transforms.size(); j++)
|
|
|
{
|
|
{
|
|
|
- file << "local inst = scene:newInstanceNode(\""
|
|
|
|
|
|
|
+ file << "inst = scene:newInstanceNode(\""
|
|
|
<< name << "_inst" << (j - 1) << "\")\n"
|
|
<< name << "_inst" << (j - 1) << "\")\n"
|
|
|
<< "node:getSceneNodeBase():addChild("
|
|
<< "node:getSceneNodeBase():addChild("
|
|
|
<< "inst:getSceneNodeBase())\n";
|
|
<< "inst:getSceneNodeBase())\n";
|