std::string stlName = filePth.toStdString();//stl文件的路径
ifstream file;
file.open(stlName);
std::string line;
float vx = 0, vy = 0, vz = 0;
float nx = 0, ny = 0, nz = 0;
int index = 0;
m_border[0] = glm::vec3(100.0);
m_border[1] = glm::vec3(-100.0);
IMPLANT_VERTEX_STRUCT impalntVertex; //种植体的数据包括直径 长度等
uang
while (!file.eof())
{
file >> line;
if (line == "normal")
{
file >> nx >> ny >> nz;
impalntVertex.normal = glm::vec3(nx, ny, nz);
}
else if (line == "vertex")
{
file >> vx >> vy >> vz;
m_border[0].x = (m_border[0].x > vx) ? vx : m_border[0].x;
m_border[0].y = (m_border[0].y > vy) ? vy : m_border[0].y;
m_border[0].z = (m_border[0].z > vz) ? vz : m_border[0].z;
m_border[1].x = (m_border[1].x < vx) ? vx : m_border[1].x;
m_border[1].y = (m_border[1].y < vy) ? vy : m_border[1].y;
m_border[1].z = (m_border[1].z < vz) ? vz : m_border[1].z;
impalntVertex.pos = glm::vec3(vx, vy, vz);
m_vertex_vc.push_back(impalntVertex);
}
}
/*三角片的个数*/
m_triangleNumber = m_vertex_vc.size() / 3;
for (int index = 0, num = m_vertex_vc.size(); index < num; index++)
{
m_indice_vc.push_back(index);
}