Fix NB mesh not being built correctly on .nbe file load
parent
2da4ad0718
commit
2ac7f5a56b
|
@ -292,19 +292,20 @@ void NBEFileFormat::parseLine(Project * project, std::string & line)
|
|||
s[i] = trim(n.substr(0, nid));
|
||||
n = trim(n.substr(nid));
|
||||
}
|
||||
node->addNodeBox();
|
||||
node->GetCurrentNodeBox()->name = s[0];
|
||||
node->GetCurrentNodeBox()->one = vector3df(
|
||||
(f32)atof(s[1].c_str()),
|
||||
(f32)atof(s[2].c_str()),
|
||||
(f32)atof(s[3].c_str())
|
||||
);
|
||||
node->GetCurrentNodeBox()->two = vector3df(
|
||||
(f32)atof(s[4].c_str()),
|
||||
(f32)atof(s[5].c_str()),
|
||||
(f32)atof(s[6].c_str())
|
||||
);
|
||||
node->remesh();
|
||||
NodeBox *box = node->addNodeBox(
|
||||
vector3df(
|
||||
(f32)atof(s[1].c_str()),
|
||||
(f32)atof(s[2].c_str()),
|
||||
(f32)atof(s[3].c_str())
|
||||
),
|
||||
vector3df(
|
||||
(f32)atof(s[4].c_str()),
|
||||
(f32)atof(s[5].c_str()),
|
||||
(f32)atof(s[6].c_str())
|
||||
));
|
||||
box->name = s[0];
|
||||
box->rebuild_needed = true;
|
||||
node->remesh(box);
|
||||
} else if (lower.find("end node") == 0){
|
||||
project->AddNode(node);
|
||||
node = NULL;
|
||||
|
|
|
@ -60,19 +60,18 @@ NodeBox* Node::GetNodeBox(int id)
|
|||
}
|
||||
|
||||
// Operation functions
|
||||
NodeBox* Node::addNodeBox()
|
||||
NodeBox* Node::addNodeBox(vector3df one, vector3df two)
|
||||
{
|
||||
_box_count++;
|
||||
// Name it
|
||||
std::string name = "NodeBox" + num_to_str(_box_count);
|
||||
|
||||
// Set up structure
|
||||
NodeBox* tmp = new NodeBox(name,
|
||||
vector3df(-0.5, -0.5, -0.5),
|
||||
vector3df(0.5, 0.5, 0.5));
|
||||
|
||||
std::string name = "NodeBox" + num_to_str(_box_count);
|
||||
NodeBox *tmp = new NodeBox(name, one, two);
|
||||
boxes.push_back(tmp);
|
||||
|
||||
// Select
|
||||
select(boxes.size() - 1);
|
||||
|
||||
tmp->buildMesh(state, position, device, images);
|
||||
|
||||
return tmp;
|
||||
|
|
|
@ -21,7 +21,8 @@ public:
|
|||
unsigned int NodeId() const { return _nid; }
|
||||
NodeBox* GetCurrentNodeBox();
|
||||
NodeBox* GetNodeBox(int id);
|
||||
NodeBox* addNodeBox();
|
||||
NodeBox* addNodeBox(vector3df one = vector3df(-0.5, -0.5, -0.5),
|
||||
vector3df two = vector3df(0.5, 0.5, 0.5));
|
||||
void deleteNodebox(int id);
|
||||
void cloneNodebox(int id);
|
||||
void select(int id) { _selected = id; }
|
||||
|
|
Loading…
Reference in New Issue