本文整理汇总了C++中scene::Ptr类的典型用法代码示例。如果您正苦于以下问题:C++ Ptr类的具体用法?C++ Ptr怎么用?C++ Ptr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Ptr类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadModelGL
void ModelRenderer::LoadModelGL() {
Scene::Ptr scene = GetScene();
// Clear out any previously loaded model.
ClearModel();
// Load the model as a scene graph resource.
Scene::Ptr model = AssetImporter::ImportFile(GetResources(), model_fname_);
if (!model) {
return;
}
// Create a node in the main scene graph.
node_ = scene->MakeGroup(GetBaseNode());
// Instantiate the model as a child of the newly created node.
scene->MakeGroupFromScene(node_, model);
// Scale and translate the model so that it fits inside a unit cube
// centered at the origin.
const AxisAlignedBox& box = model->Root()->WorldBoundingBox();
const QVector3D span = box.Max() - box.Min();
const float max_span = std::max(std::max(span.x(), span.y()), span.z());
const double scale_factor = 1.0 / max_span;
node_->SetScale(QVector3D(scale_factor, scale_factor, scale_factor));
node_->SetTranslation(-0.5 * scale_factor * (box.Max() + box.Min()));
GetViewport()->ScheduleRedraw();
}
示例2: onPointCloudReceived
void ObjectDetectionViewer::onPointCloudReceived(PointCloud<Point>::ConstPtr cloud) {
posix_time::ptime startTime = posix_time::microsec_clock::local_time();
Scene::Ptr scene = Scene::fromPointCloud(cloud, config);
Table::Collection detectedTables = tableDetector.detectTables(scene);
Object::Collection detectedObjects = objectDetector.detectObjects(scene, detectedTables);
{
mutex::scoped_lock(resultMutex);
this->detectedTables = detectedTables;
this->detectedObjects = detectedObjects;
}
posix_time::time_duration diff = posix_time::microsec_clock::local_time() - startTime;
processingTime = diff.total_milliseconds();
showPointCloud(scene->getFullPointCloud());
}
示例3: InitializeGL
void StockShapeRenderer::InitializeGL() {
Scene::Ptr scene = GetScene();
ResourceManager::Ptr resources = GetResources();
GroupNode* base_node = GetBaseNode();
// Create a material to share among several shapes
StockResources stock(resources);
material_ = stock.NewMaterial(StockResources::kUniformColorLighting);
material_->SetParam(sv::kDiffuse, 1.0, 0.5, 0.5, 1.0);
material_->SetParam(sv::kSpecular, 1.0, 0.5, 0.5, 1.0);
material_->SetParam(sv::kShininess, 10.0f);
// Create a material to use for the selected shape
select_material_ = stock.NewMaterial(StockResources::kUniformColorLighting);
select_material_->SetParam(sv::kDiffuse, 1.0, 0.0, 1.0, 1.0);
select_material_->SetParam(sv::kSpecular, 1.0, 0.0, 0.1, 1.0);
select_material_->SetParam(sv::kShininess, 16.0f);
// Create a bunch of shapes
shapes_.push_back(scene->MakeDrawNode(base_node, stock.Cone(), material_));
shapes_.push_back(scene->MakeDrawNode(base_node, stock.Cube(), material_));
shapes_.push_back(scene->MakeDrawNode(base_node, stock.Cylinder(), material_));
shapes_.push_back(scene->MakeDrawNode(base_node, stock.Sphere(), material_));
DrawNode* axes = scene->MakeDrawNode(base_node);
axes->Add(stock.UnitAxes());
shapes_.push_back(axes);
// Move the shapes so they're not all on top of each other.
//
// Also set the selection mask for each node so that they can be selected by
// StockShapeSelector
const double spacing = 2.0;
const double x_start = - spacing * shapes_.size() / 2;
for (size_t i = 0; i < shapes_.size(); ++i) {
shapes_[i]->SetTranslation(x_start + i * spacing, 0, 0);
shapes_[i]->SetSelectionMask(1);
}
}
示例4: AddHastedLayerTo
void AddHastedLayerTo(Scene::Ptr scene, float frequency, Vector2DF position)
{
auto layer = make_shared<Layer2D>();
auto object = make_shared<MovingObject>();
layer->SetUpdateFrequency(frequency);
object->SetTexture(asd::Engine::GetGraphics()->CreateTexture2D(ToAString("Data/Texture/Cloud1.png").c_str()));
object->SetScale(Vector2DF(0.5f, 0.5f));
object->SetPosition(position);
scene->AddLayer(layer);
layer->AddObject(object);
}
示例5: cloud
// Read in a 3D model
void
loadPolygonMeshModel (char* polygon_file)
{
pcl::PolygonMesh mesh;
pcl::io::loadPolygonFile (polygon_file, mesh);
pcl::PolygonMesh::Ptr cloud (new pcl::PolygonMesh (mesh));
TriangleMeshModel::Ptr model = TriangleMeshModel::Ptr (new TriangleMeshModel (cloud));
scene_->add (model);
std::cout << "Just read " << polygon_file << std::endl;
std::cout << mesh.polygons.size () << " polygons and "
<< mesh.cloud.data.size () << " triangles\n";
}
示例6: load_model
void load_model(const std::vector<std::string> & files)
{
for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file)
{
std::cout << "Load model: " << *file << std::endl;
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZRGB>);
if (pcl::io::loadPCDFile<pcl::PointXYZRGB> (*file, *cloud) == -1) //* load the file
{
PCL_ERROR ("Couldn't read file %s \n", file->c_str()) ;
exit (-1);
}
PointCloudModel::Ptr model = PointCloudModel::Ptr(new PointCloudModel(GL_POLYGON, cloud));
scene_->add(model);
}
}
示例7: load_PolygonMesh_model
// Read in a 3D model
void load_PolygonMesh_model (char* polygon_file)
{
pcl::PolygonMesh mesh; // (new pcl::PolygonMesh);
//pcl::io::loadPolygonFile("/home/mfallon/data/models/dalet/Darlek_modified_works.obj",mesh);
pcl::io::loadPolygonFile (polygon_file, mesh);
pcl::PolygonMesh::Ptr cloud (new pcl::PolygonMesh (mesh));
// Not sure if PolygonMesh assumes triangles if to
// TODO: Ask a developer
PolygonMeshModel::Ptr model = PolygonMeshModel::Ptr (new PolygonMeshModel (GL_POLYGON, cloud));
scene_->add (model);
std::cout << "Just read " << polygon_file << std::endl;
std::cout << mesh.polygons.size () << " polygons and "
<< mesh.cloud.data.size () << " triangles\n";
}
示例8: exit
// Read in a 3D model
void
load_PolygonMesh_model (std::string polygon_file)
{
pcl::PolygonMesh mesh; // (new pcl::PolygonMesh);
//pcl::io::loadPolygonFile("/home/mfallon/data/models/dalet/Darlek_modified_works.obj",mesh);
if (!pcl::io::loadPolygonFile (polygon_file, mesh)){
std::cout << "No ply file found, exiting" << std::endl;
exit(-1);
}
pcl::PolygonMesh::Ptr cloud (new pcl::PolygonMesh (mesh));
TriangleMeshModel::Ptr model = TriangleMeshModel::Ptr (new TriangleMeshModel (cloud));
scene_->add (model);
std::cout << "Just read " << polygon_file << std::endl;
std::cout << mesh.polygons.size () << " polygons and "
<< mesh.cloud.data.size () << " triangles\n";
}