本文整理汇总了C++中Selection::SetFaces方法的典型用法代码示例。如果您正苦于以下问题:C++ Selection::SetFaces方法的具体用法?C++ Selection::SetFaces怎么用?C++ Selection::SetFaces使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Selection
的用法示例。
在下文中一共展示了Selection::SetFaces方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessNaviMesh
bool Selector::ProcessNaviMesh(Node *node, AI::NaviMesh *mesh)
{
if (mesh)
{
auto line = m_local_transform.top().Inversed() * m_view_ray;
std::vector<Math::vec3> points;
std::vector<size_t> faces;
Math::Relation res = Math::CrossLineTriangles(line, mesh->GetPoints(), mesh->GetFaces(), points, faces);
if (res == Math::Relation::INTERSECT)
{
// return points to the worlds coordinate system
for (auto& p : points)
{
p = m_local_transform.top() * p;
}
Selection selection;
selection.SetPoints(points);
selection.SetFaces(faces);
selection.SetObject(node);
m_selections.push_back(selection);
}
}
ProcessChildren(node);
return true;
}
示例2: ProcessTerrainMesh
bool Selector::ProcessTerrainMesh(Node *node, Virtual::TerrainMesh *terrain)
{
if (terrain)
{
Virtual::StaticGeometry* geom = terrain->GetGeometry();
if (geom)
{
Math::Line3D line = m_local_transform.top().Inversed() * m_view_ray;
std::vector<Math::vec3> points;
std::vector<size_t> faces;
Math::Relation r = Math::CrossLineTriangles(line, geom->GetCpuCache().GetVertices(), geom->GetCpuCache().GetFaces(), points, faces);
if (r == Math::Relation::INTERSECT)
{
Selection selection;
// return points to the worlds coordinate system
for (auto& p : points)
{
p = m_local_transform.top() * p;
}
selection.SetPoints(points);
selection.SetFaces(faces);
selection.SetObject(node);
m_selections.push_back(selection);
}
}
}
ProcessChildren(node);
return true;
}
示例3: ProcessStaticGeometry
bool Selector::ProcessStaticGeometry(Node *node, Virtual::StaticGeometry *geom)
{
if (geom)
{
if (geom->GetCpuCache().IsOnCpu())
{
bool has_bsphere = false;
bool has_bbox = false;
Math::Line3D line = m_local_transform.top().Inversed() * m_view_ray;
if (m_check_bounding_sphere)
{
const Math::BoundingSphere& sphere = geom->GetBoundingSphere();
Math::vec3 p1, p2;
Math::Relation r = Math::CrossLineSphere(line, sphere, p1, p2);
if (r == Math::Relation::INTERSECT_2)
{
std::vector<Math::vec3> p(2);
p[0]= m_local_transform.top() * p1;
p[1] = m_local_transform.top() * p2;
Selection s;
s.SetPoints(p);
s.SetType(SelectionType::BoundingSphere);
s.SetObject(node);
m_selections.push_back(s);
has_bsphere = true;
}
if (r == Math::Relation::INTERSECT_1)
{
std::vector<Math::vec3> p(1);
p[0]= m_local_transform.top() * p1;
Selection s;
s.SetPoints(p);
s.SetType(SelectionType::BoundingSphere);
s.SetObject(node);
m_selections.push_back(s);
has_bsphere = true;
}
}
if (m_check_bounding_box)
{
if (has_bsphere || !m_check_bounding_sphere)
{
const Math::BoundingBox& bbox = geom->GetBoundingBox();
Math::vec3 p;
Math::Relation r = Math::CrossLineBoundingBox(line, bbox, p);
if (r == Math::Relation::INTERSECT)
{
std::vector<Math::vec3> points(1);
points[0] = m_local_transform.top() * p;
Selection s;
s.SetPoints(points);
s.SetType(SelectionType::BoundingBox);
s.SetObject(node);
m_selections.push_back(s);
has_bbox = true;
}
}
}
if (m_check_geometry)
{
if (has_bbox || !m_check_bounding_box)
{
std::vector<Math::vec3> points;
std::vector<size_t> faces;
Math::Relation r = Math::CrossLineTriangles(line, geom->GetCpuCache().GetVertices(), geom->GetCpuCache().GetFaces(), points, faces);
if (r == Math::Relation::INTERSECT)
{
// return points to the worlds coordinate system
for (auto& p : points)
{
p = m_local_transform.top() * p;
}
Selection selection;
selection.SetPoints(points);
selection.SetFaces(faces);
selection.SetType(SelectionType::Geometry);
selection.SetObject(node);
m_selections.push_back(selection);
}
}
}
}
}
return ProcessChildren(node);
}