随笔分类 - openscenegraph(osg)
摘要:#pragma once #include <osgGA/TrackballManipulator> #include<osgGA/CameraManipulator> #include<osgGA/GUIActionAdapter> #include <osg/Group> #include <o
阅读全文
摘要:osg三维场景中拾取鼠标在模型表面的点击点 #include <osg/Group> #include <osg/Geode> #include <osg/ShapeDrawable> #include <osgDB/ReadFile> #include <osgViewer/Viewer> #in
阅读全文
摘要:#include <osg/Node> #include <osg/Geode> #include <osg/ShapeDrawable> #include <osgViewer/Viewer> #include <osgGA/GUIEventHandler> // 自定义的视图切换事件处理器 cl
阅读全文
摘要:osg qt场景中节点的透明属性消除 { osg::ref_ptr<osg::StateSet> stateState = north_wall_geode->getOrCreateStateSet(); stateState->setMode(GL_BLEND, osg::StateAttribu
阅读全文
摘要:#include <opencv2/opencv.hpp> int main() { // 读取图像 cv::Mat image = cv::imread("image.jpg"); // 获取图像的行数和列数 int rows = image.rows; int cols = image.cols
阅读全文
摘要:#include <opencv2/opencv.hpp> int main() { // 创建一个空的图片,宽度为500像素,高度为500像素,通道数为3(RGB),数据类型为8位无符号整数 cv::Mat image = cv::Mat::zeros(500, 500, CV_8UC3); //
阅读全文
摘要:osg给节点添加材质 #include <osg/Material> #include <osg/Geode> #include <osgDB/ReadFile> #include <osgViewer/Viewer> int main(){ // 创建一个场景节点 osg::ref_ptr<osg
阅读全文
摘要:osg绘制粗线条 #include <osg/Geometry> #include <osg/Geode> #include <osgViewer/Viewer> #include <osg/LineWidth> int main() { // 创建几何体对象 osg::ref_ptr<osg::G
阅读全文
摘要:#include <osg/Material> #include <osg/Geode> #include <osgDB/ReadFile> #include <osgViewer/Viewer> int main() { // 创建一个场景节点 osg::ref_ptr<osg::Node> ro
阅读全文
摘要:opencv转qimage #include <opencv2/opencv.hpp> #include <QImage> #include <QColor> QImage MatToQImage(const cv::Mat &mat) { // 获取图像尺寸和通道数 int width = mat
阅读全文
摘要:osg::ref_ptr<osg::Node> root = ...; // 获取场景根节点 // 遍历场景图并删除所有节点 osg::Node::Children::iterator it; for (it = root->getChildren().begin(); it != root->ge
阅读全文
摘要:osg设置节点材质 #include <osg/Geode> #include <osg/Material> #include <osgDB/ReadFile> int main() { // 创建一个 Geode 对象 osg::ref_ptr<osg::Geode> geode = new os
阅读全文
摘要:#include <osg/Geode> #include <osgText/Text3D> int main() { // 创建场景图 osg::ref_ptr<osg::Group> root = new osg::Group(); osg::ref_ptr<osg::Geode> geode
阅读全文
摘要:#include <osg/Node> #include <osgViewer/Viewer> #include <osgDB/ReadFile> #include <osg/ShapeDrawable> int main() { // 创建Box对象 osg::ref_ptr<osg::Box>
阅读全文
摘要:osg添加光源 #include <osg/Light>#include <osg/LightSource>#include <osg/Node>#include <osg/Geode>#include <osgDB/ReadFile>#include <osgViewer/Viewer>int m
阅读全文
摘要:osg Node节点透明度 osg::ref_ptr<osg::StateSet> stateState = north_wall_geode->getOrCreateStateSet(); stateState->setMode(GL_BLEND, osg::StateAttribute::ON)
阅读全文
摘要:osg绘制3D字体 osg::ref_ptr<osgText::Text3D> xText3D = new osgText::Text3D(); xText3D->setFont("font/arial.ttf"); xText3D->setCharacterSize(30); xText3D->s
阅读全文
摘要:osg创建立方体 osg::Geode* createBox(double minX, double maxX, double minY, double maxY, double minZ, double maxZ) { double X1 = minX; double X2 = maxX; dou
阅读全文
摘要:osg绘制闭合曲线 osg::TessellationHints* outline_hits1 = new osg::TessellationHints(); outline_hits1->setDetailRatio(0.9f); osg::Geode* outline_geode = new o
阅读全文
摘要:塔吊花车移动计算 void TowerPanel::slotMoveSlider(int sliderValue) { slider_length = sliderValue*1.0f; hook_position_x = center_x*(-0.0f) + slider_length*cos(a
阅读全文