30 #ifndef MODULES_VISUALIZATION_MESH_CONSTRUCTION_H
31 #define MODULES_VISUALIZATION_MESH_CONSTRUCTION_H
34 #include <Core/Datatypes/Mesh/VMesh.h>
35 #include <Core/Datatypes/Mesh/Mesh.h>
43 namespace Visualization {
45 namespace MeshConstruction
49 template <
typename VMeshType>
52 const std::string& primaryVBOName,
56 uint32_t* iboFaces =
nullptr;
60 size_t iboFacesSize = 0;
61 BOOST_FOREACH(
const FaceInfo<VMeshType>& face, facade->faces())
63 typename VMeshType::Node::array_type nodes = face.nodeIndices();
64 if (nodes.size() == 4)
66 iboFacesSize +=
sizeof(uint32_t) * 6;
68 else if (nodes.size() == 3)
70 iboFacesSize +=
sizeof(uint32_t) * 3;
78 std::shared_ptr<std::vector<uint8_t>> rawIBO(
new std::vector<uint8_t>());
79 rawIBO->resize(iboFacesSize);
81 iboFaces =
reinterpret_cast<uint32_t*
>(&(*rawIBO)[0]);
83 BOOST_FOREACH(
const FaceInfo<VMeshType>& face, facade->faces())
85 typename VMeshType::Node::array_type nodes = face.nodeIndices();
86 if (nodes.size() == 4)
89 iboFaces[i ] =
static_cast<uint32_t
>(nodes[0]); iboFaces[i+1] =
static_cast<uint32_t
>(nodes[1]); iboFaces[i+2] =
static_cast<uint32_t
>(nodes[2]);
90 iboFaces[i+3] =
static_cast<uint32_t
>(nodes[0]); iboFaces[i+4] =
static_cast<uint32_t
>(nodes[2]); iboFaces[i+5] =
static_cast<uint32_t
>(nodes[3]);
93 else if (nodes.size() == 3)
95 iboFaces[i ] =
static_cast<uint32_t
>(nodes[0]); iboFaces[i+1] =
static_cast<uint32_t
>(nodes[1]); iboFaces[i+2] =
static_cast<uint32_t
>(nodes[2]);
103 std::string facesIBOName =
"facesIBO";
104 geom->mIBOs.emplace_back(GeometryObject::SpireIBO(facesIBOName,
sizeof(uint32_t), rawIBO));
108 GeometryObject::SpireSubPass pass =
109 GeometryObject::SpireSubPass(
"facesPass", primaryVBOName,
110 facesIBOName,
"UniformColor",
111 Spire::StuInterface::TRIANGLES);
112 if (faceTransparency)
113 pass.addUniform(
"uColor", Spire::V4(1.0f, 1.0f, 1.0f, 0.2f));
115 pass.addUniform(
"uColor", Spire::V4(1.0f, 1.0f, 1.0f, 1.0f));
117 geom->mPasses.emplace_back(pass);
122 template <
typename VMeshType>
125 const std::string& primaryVBOName,
130 template <
typename VMeshType>
133 const std::string& primaryVBOName,
boost::shared_ptr< ModuleStateInterface > ModuleStateHandle
Definition: NetworkFwd.h:75
boost::shared_ptr< GeometryObject > GeometryHandle
Definition: DatatypeFwd.h:61
boost::error_info< struct tag_error_message, std::string > ErrorMessage
Definition: Exception.h:52
void buildNodesNoNormals(typename SCIRun::Core::Datatypes::MeshTraits< VMeshType >::MeshFacadeHandle facade, SCIRun::Core::Datatypes::GeometryHandle geom, const std::string &primaryVBOName, ModuleStateHandle state)
Definition: Exception.h:78
static Core::Algorithms::AlgorithmParameterName FaceTransparency
Definition: ShowField.h:55
void buildEdgesNoNormals(typename SCIRun::Core::Datatypes::MeshTraits< VMeshType >::MeshFacadeHandle facade, SCIRun::Core::Datatypes::GeometryHandle geom, const std::string &primaryVBOName, ModuleStateHandle state)
boost::shared_ptr< MeshFacade< VirtualMeshType > > MeshFacadeHandle
Definition: MeshTraits.h:61