osg

MFC加载大型osg模型

。_饼干妹妹 提交于 2019-11-29 04:59:47
MFC加载模型,发现打开 Navid 缓冲等选项后,加载大型模型的速度就快了很多。 #include "stdafx.h" #include "OSGObject.h" COSGObject::COSGObject(HWND hWnd) { m_hwnd = hWnd; } COSGObject::~COSGObject() { } void COSGObject::InitOSG() { InitSceneGraph(); InitCameraConfig(); } void COSGObject::InitSceneGraph() { mRoot = new osg::Group; //mRoot->addChild(osgDB::readNodeFile("D://library.OSGB")); //mRoot->addChild(osgDB::readNodeFile("I:\\BIM\\osg\\pzy20190722.OSGB")); //mRoot->addChild(osgDB::readNodeFile("D:\\参考手册\\BIM\\ive\\build20190628.ive")); mRoot->addChild(osgDB::readNodeFile("I:\\BIM\\osg\\wanluowang20190903.OSGB")); } void

osg创建灯光

*爱你&永不变心* 提交于 2019-11-29 04:57:17
添加光照 osg::ref_ptr<osg::Node> MyOSGLoadEarth::CreateNode() { osg::ref_ptr<osg::Group> _root = new osg::Group; //定义并读取高程文件 //真实高程文件名称为:ASTGTM2_N34E110_dem.tif //属于特殊的tiff格式,GEOTiff //读取的时候使用osg的gdal插件进行读取,所以在路径后面加上了.gdal //.gdal后缀名只要在这里加就可以了,真实的高程文件后缀名不需要修改 osg::ref_ptr<osg::HeightField> heightMap = osgDB::readHeightFieldFile("G:\\ASTER.GDEM.V2-DEM_sn\\ASTGTM2_N34E110_dem.tif.gdal"); //创建一个叶结点对象 osg::ref_ptr<osg::Geode> geode = new osg::Geode; if (heightMap != nullptr) { //由于原始数据过大,创建三维对象会失败,所以重新构造一个对象 //相当于数据抽稀了一次。当然,可以直接把原图使用特殊工具裁了 //创建一个新的HeightField对象,用来拷贝heightMap osg::ref_ptr<osg:

MFC加载osg模型

风流意气都作罢 提交于 2019-11-29 03:25:38
创建MFC单文档项目, OSGObject.h #pragma once #include <osgViewer\Viewer> #include <osgDB\ReadFile> #include <osgViewer\api\Win32\GraphicsWindowWin32> #include <osgGA\TrackballManipulator> #include <osg\Group> class COSGObject { public: COSGObject(HWND hWnd); ~COSGObject(); void InitOSG(); void InitSceneGraph(); void InitCameraConfig(); void PreFrameUpdate(); void PostFrameUpdate(); static void Render(void* ptr); osgViewer::Viewer* getOsgViewer(); private: HWND m_hwnd; osgViewer::Viewer* mViewer; osg::ref_ptr<osg::Group> mRoot; }; OSGObject.cpp #pragma once #include <osgViewer\Viewer> #include <osgDB

osg gis编译日志

ぐ巨炮叔叔 提交于 2019-11-29 01:54:52
1>------ 已启动全部重新生成: 项目: ZERO_CHECK, 配置: Debug x64 ------ 1> Checking Build System 1> CMake does not need to re-run because E:/OpenSourceGraph/osggis_build/CMakeFiles/generate.stamp is up-to-date. 1> CMake does not need to re-run because E:/OpenSourceGraph/osggis_build/src/CMakeFiles/generate.stamp is up-to-date. 1> CMake does not need to re-run because E:/OpenSourceGraph/osggis_build/src/osgGIS/CMakeFiles/generate.stamp is up-to-date. 1> CMake does not need to re-run because E:/OpenSourceGraph/osggis_build/src/osgGISProjects/CMakeFiles/generate.stamp is up-to-date. 1> CMake does not need to re

VPB编译日志2

雨燕双飞 提交于 2019-11-29 00:38:54
1>------ 已启动全部重新生成: 项目: ZERO_CHECK, 配置: Debug x64 ------ 1> Checking Build System 1> CMake does not need to re-run because E:/OpenSourceGraph/VirtualPlanetBuilder_0_9_build/CMakeFiles/generate.stamp is up-to-date. 1> CMake does not need to re-run because E:/OpenSourceGraph/VirtualPlanetBuilder_0_9_build/src/CMakeFiles/generate.stamp is up-to-date. 1> CMake does not need to re-run because E:/OpenSourceGraph/VirtualPlanetBuilder_0_9_build/src/vpb/CMakeFiles/generate.stamp is up-to-date. 1> CMake does not need to re-run because E:/OpenSourceGraph/VirtualPlanetBuilder_0_9_build/applications

VPB编译日志1

本小妞迷上赌 提交于 2019-11-29 00:37:20
1>------ 已启动全部重新生成: 项目: ZERO_CHECK, 配置: Release x64 ------ 1> Checking Build System 1> CMake does not need to re-run because E:/OpenSourceGraph/VirtualPlanetBuilder_0_9_build/CMakeFiles/generate.stamp is up-to-date. 1> CMake does not need to re-run because E:/OpenSourceGraph/VirtualPlanetBuilder_0_9_build/src/CMakeFiles/generate.stamp is up-to-date. 1> CMake does not need to re-run because E:/OpenSourceGraph/VirtualPlanetBuilder_0_9_build/src/vpb/CMakeFiles/generate.stamp is up-to-date. 1> CMake does not need to re-run because E:/OpenSourceGraph/VirtualPlanetBuilder_0_9_build/applications

OSG与Shader的结合使用

隐身守侯 提交于 2019-11-28 20:39:47
目录 1. 概述 2. 固定管线着色 3. 纹理着色 4. 参考 1. 概述 以往在OpenGL中学习渲染管线的时候,是依次按照申请数据、传送缓冲区、顶点着色器、片元着色器这几个步骤编程的。OSG是OpenGL的一些顶层的封装,使用shader的时候看不到这些步骤了,所以有点不习惯。这里我总结了两个最简单的例子。 2. 固定管线着色 OSG一个最简单的示例是展示自带的数据glider.osg: #include <iostream> #include <Windows.h> #include <osgViewer/Viewer> #include <osgDB/ReadFile> using namespace std; int main() { osg::ref_ptr<osg::Group> root= new osg::Group(); string osgPath = "D:/Work/OSGBuild/OpenSceneGraph-Data/glider.osg"; osg::Node * node = osgDB::readNodeFile(osgPath); root->addChild(node); osgViewer::Viewer viewer; viewer.setSceneData(root); viewer.setUpViewInWindow(100,

osgViewer

回眸只為那壹抹淺笑 提交于 2019-11-28 20:17:16
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for

多自由度机械臂模拟2

江枫思渺然 提交于 2019-11-28 13:34:42
osg::ref_ptr<osg::Geode> rope1 = CreateCylinder(0, 0, 7, 0.1f); osg::ref_ptr<osg::Geode> rope2 = CreateCylinder(0, 0, 8, 0.1f); osg::ref_ptr<osg::Geode> rope3 = CreateCylinder(0, 0, 9, 0.1f); osg::ref_ptr<osg::Geode> rope4 = CreateCylinder(0, 0, 10, 0.1f); osg::ref_ptr<osg::Geode> rope5 = CreateCylinder(0, 0, 11, 0.1f); groupRope->addChild(rope1.get()); groupRope->addChild(rope2.get()); groupRope->addChild(rope3.get()); groupRope->addChild(rope4.get()); groupRope->addChild(rope5.get()); rotRope = new osg::MatrixTransform; rotRope->addChild(groupRope.get()); rotateRope1(); 来源: https://www

osg::Node源码

送分小仙女□ 提交于 2019-11-27 16:08:00
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for