本文整理汇总了C++中ViewportRecPtr::get方法的典型用法代码示例。如果您正苦于以下问题:C++ ViewportRecPtr::get方法的具体用法?C++ ViewportRecPtr::get怎么用?C++ ViewportRecPtr::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewportRecPtr
的用法示例。
在下文中一共展示了ViewportRecPtr::get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
preloadSharedObject("OSGImageFileIO");
preloadSharedObject("OSGContribParticleSystem");
// OSG init
osgInit(argc,argv);
{
// Set up Window
WindowEventProducerRecPtr TutorialWindow = createNativeWindow();
TutorialWindow->initWindow();
// Create the SimpleSceneManager helper
SimpleSceneManager sceneManager;
TutorialWindow->setDisplayCallback(boost::bind(display, &sceneManager));
TutorialWindow->setReshapeCallback(boost::bind(reshape, _1, &sceneManager));
// Tell the Manager what to manage
sceneManager.setWindow(TutorialWindow);
// Make Torus Node (creates Torus in background of scene)
NodeRefPtr TorusGeometryNode = makeTorus(.5, 2, 16, 16);
// Make Main Scene Node and add the Torus
NodeRefPtr scene = OSG::Node::create();
scene->setCore(OSG::Group::create());
scene->addChild(TorusGeometryNode);
// Tell the Manager what to manage
sceneManager.setRoot(scene);
ViewportRecPtr TutorialViewport = sceneManager.getWindow()->getPort(0);
// Create the Graphics
GraphicsRefPtr TutorialGraphics = OSG::Graphics2D::create();
// Initialize the LookAndFeelManager to enable default settings
LookAndFeelManager::the()->getLookAndFeel()->init();
//Background
SolidBackgroundRefPtr TutorialBackground = SolidBackground::create();
TutorialBackground->setColor(Color3f(1.0,0.0,0.0));
UndoManagerPtr TheUndoManager = UndoManager::create();
CommandManagerPtr TheCommandManager = CommandManager::create(TheUndoManager);
//UndoList
DefaultListModelRecPtr UndoRedoListModel = DefaultListModel::create();
UndoRedoListModel->pushBack(boost::any(std::string("Top")));
ListRecPtr UndoRedoList = List::create();
UndoRedoList->setPreferredSize(Vec2f(250, 300));
UndoRedoList->setOrientation(List::VERTICAL_ORIENTATION);
UndoRedoList->setModel(UndoRedoListModel);
UndoRedoList->getSelectionModel()->connectSelectionChanged(boost::bind(&handleUndoRedoListSelectionChanged, _1, TheUndoManager));
ButtonRecPtr UndoButton = OSG::Button::create();
UndoButton->setText("Undo");
UndoButton->setEnabled(false);
UndoButton->connectActionPerformed(boost::bind(&handleUndoButtonAction, _1, TheUndoManager));
ButtonRecPtr RedoButton = OSG::Button::create();
RedoButton->setText("Redo");
RedoButton->setEnabled(false);
RedoButton->connectActionPerformed(boost::bind(&handleRedoButtonActionPerformed, _1, TheUndoManager));
TheUndoManager->connectStateChanged(boost::bind(&handleUndoManagerStateChanged, _1, UndoButton.get(), RedoButton.get(), UndoRedoListModel.get(), TheUndoManager));
// Create a ScrollPanel for easier viewing of the List (see 27ScrollPanel)
ScrollPanelRefPtr UndoRedoScrollPanel = ScrollPanel::create();
UndoRedoScrollPanel->setPreferredSize(Vec2f(200,200));
UndoRedoScrollPanel->setHorizontalResizePolicy(ScrollPanel::RESIZE_TO_VIEW);
UndoRedoScrollPanel->setViewComponent(UndoRedoList);
//Background Editor Field
FieldContainerEditorComponentRefPtr TheEditor = FieldContainerEditorFactory::the()->createDefaultEditor(TutorialBackground, TheCommandManager);
//FieldContainerEditorComponentRefPtr TheEditor = FieldContainerEditorFactory::the()->createDefaultEditor(RedoButton, TheCommandManager);
//FieldContainerEditorComponentRefPtr TheEditor = FieldContainerEditorFactory::the()->createDefaultEditor(dynamic_cast<Geometry*>(TorusGeometryNode->getCore())->getMaterial(), TheCommandManager);
ScrollPanelRefPtr EditorScrollPanel = ScrollPanel::create();
EditorScrollPanel->setPreferredSize(Vec2f(300,400));
EditorScrollPanel->setViewComponent(TheEditor);
//Undo Panel
LabelRecPtr UndoPanelLabel = Label::create();
UndoPanelLabel->setText("Undo Panel");
UndoPanelLabel->setPreferredSize(Vec2f(100.0f, 20.0f));
LayoutRefPtr UndoPanelLayout = OSG::FlowLayout::create();
PanelRecPtr UndoPanel = Panel::create();
UndoPanel->setPreferredSize(Vec2f(300.0f,300.0f));
UndoPanel->pushToChildren(UndoPanelLabel);
UndoPanel->pushToChildren(UndoRedoScrollPanel);
UndoPanel->pushToChildren(UndoButton);
UndoPanel->pushToChildren(RedoButton);
UndoPanel->setLayout(UndoPanelLayout);
// Create The Main InternalWindow
//.........这里部分代码省略.........