本文整理汇总了C++中GeometryNode::getMesh方法的典型用法代码示例。如果您正苦于以下问题:C++ GeometryNode::getMesh方法的具体用法?C++ GeometryNode::getMesh怎么用?C++ GeometryNode::getMesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeometryNode
的用法示例。
在下文中一共展示了GeometryNode::getMesh方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: describeGeometryNode
static void describeGeometryNode(ExporterContext & /*ctxt*/,DescriptionMap & desc, Node * node) {
desc.setString(Consts::ATTR_NODE_TYPE, Consts::NODE_TYPE_GEOMETRY);
std::unique_ptr<DescriptionMap> dataDesc(new DescriptionMap);
GeometryNode * gn = dynamic_cast<GeometryNode*>(node);
// annotate with bounding box
const Geometry::Box bb = gn->getBB();
const Geometry::Vec3 center = bb.getCenter();
std::stringstream s;
s << center.getX() << " " << center.getY() << " " << center.getZ() << " " << bb.getExtentX() << " " << bb.getExtentY() << " " << bb.getExtentZ();
dataDesc->setString(Consts::ATTR_MESH_BB, s.str());
Rendering::Mesh * m = gn->getMesh();
if(m!=nullptr) { // mesh present?
// no filename -> store data in .minsg
if(m->getFileName().empty()) {
std::ostringstream meshStream;
if(Rendering::Serialization::saveMesh(gn->getMesh(), "mmf", meshStream)) {
dataDesc->setString(Consts::ATTR_DATA_TYPE,"mesh");
dataDesc->setString(Consts::ATTR_DATA_ENCODING,"base64");
const std::string streamString = meshStream.str();
const std::string meshString = Util::encodeBase64(std::vector<uint8_t>(streamString.begin(), streamString.end()));
dataDesc->setString(Consts::DATA_BLOCK,meshString);
}
} else { // filename given?
Util::FileName meshFilename(m->getFileName());
// // make path to mesh relative to scene (if mesh lies below the scene)
// Util::FileUtils::makeRelativeIfPossible(ctxt.sceneFile, meshFilename);
dataDesc->setString(Consts::ATTR_DATA_TYPE,"mesh");
dataDesc->setString(Consts::ATTR_MESH_FILENAME,meshFilename.toShortString());
}
ExporterTools::addDataEntry(desc, std::move(dataDesc));
}
}