查看: 4604|回复: 6

osg加载boston.earth 出现异常 求助~

[复制链接]

该用户从未签到

发表于 2013-4-23 20:38:07 | 显示全部楼层 |阅读模式
我现在使用osgearth_viewer 观察boston.earth是正常的,我将boston.earth拷贝到osg工程下,在一个简单的osg程序中加载boston.earth,结果出现如图的情况,请问:
1 是什么原因造成的,那些背景去哪里了?
2 拿boston.earth这个文件来说,有没有办法可以去掉它里面的地球,同时保留星空背景啊、太阳什么的?是要修改earth文件吗?请各位指点一二,不胜感激。
exception.png
boston.earth的代码,需要的话,大概要改什么地方?
  1. <!--
  2. osgEarth Sample.

  3. Demonstrates the use of a Resource Library in order to apply "typical" textures
  4. to extruded buildings.
  5. -->

  6. <map name="Boston Demo" type="geocentric" version="2">
  7.    
  8.     <image name="ReadyMap.org - Imagery" driver="tms">
  9.         <url>http://readymap.org/readymap/tiles/1.0.0/22/</url>
  10.     </image>
  11.       
  12.     <model name="buildings" driver="feature_geom">
  13.             
  14.         <features name="buildings" driver="ogr">
  15.             <url>../data/boston_buildings_utm19.shp</url>
  16.             <build_spatial_index>true</build_spatial_index>
  17.         </features>
  18.         
  19.         <feature_indexing>true</feature_indexing>
  20.         
  21.         <fade_in_duration>1.0</fade_in_duration>
  22.         
  23.         <!--
  24.            The "layout" element activates tiling and paging of the feature set. If you
  25.            omit the layout element, the entire feature set will render as one pre-loaded
  26.            model (no tiling or paging).
  27.            
  28.            Each "level" is a level of detail for features, and should select a style
  29.               to use for that level. It also can specify min and max camera ranges,
  30.               in meters.
  31.               
  32.            The "tile size factor" controls how a feature is tiled. The higher this factor,
  33.               the smaller the tile size, and the more tiles will be used to render a given
  34.               level of detail. The default is 15. (The renderer multiplies a tile's radius
  35.               by the tile_size_factor to calculate the maximum suitable camera range for
  36.               a given level of subdivision. It compares this to the feature level's max
  37.               range to decide how many tiles to create.)
  38.         -->
  39.         
  40.         <layout>
  41.             <tile_size_factor>45</tile_size_factor>
  42.             <level name="default" max_range="20000">
  43.                 <selector class="buildings"/>
  44.             </level>
  45.         </layout>
  46.         
  47.         <styles>            
  48.             <library name="us_resources">
  49.                 <url>../data/resources/textures_us/catalog.xml</url>
  50.             </library>
  51.             
  52.             <style type="text/css">
  53.                 buildings {
  54.                     extrusion-height:      3.5 * max([story_ht_], 1);
  55.                     extrusion-flatten:     true;
  56.                     extrusion-wall-style:  building-wall;
  57.                     extrusion-wall-gradient: 0.8;
  58.                     extrusion-roof-style:  building-rooftop;
  59.                     altitude-clamping:     none;
  60.                 }            
  61.                 building-wall {
  62.                     skin-library:     us_resources;
  63.                     skin-tags:        building;
  64.                     skin-random-seed: 1;
  65.                     fill:             #ffffff;
  66.                 }
  67.                 building-rooftop {
  68.                     skin-library:     us_resources;
  69.                     skin-tags:        rooftop;
  70.                     skin-tiled:       true;
  71.                     skin-random-seed: 1;
  72.                     fill:             #ffffff;
  73.                 }
  74.             </style>
  75.         </styles>   
  76.     </model>
  77.    
  78.     <external>
  79.         <viewpoints>
  80.             <viewpoint name="Boston Overview" heading="24.261" height="0" lat="42.34425" long="-71.076262" pitch="-21.6" range="3450"/>
  81.             <viewpoint name="Boston Downtown 1" heading="117" lat="42.3568" long="-71.0585" height="0" pitch="-20.4" range="1500" />
  82.             <viewpoint name="Boston Downtown 2" heading="-128.5" lat="42.3582" long="-71.0546" height="0" pitch="-19" range="1620" />
  83.             <viewpoint name="Boston Street Level" heading="-145.85" lat="42.36460" long="-71.053612" pitch="-10.1" range="85.034"/>
  84.         </viewpoints>
  85.         <sky hours="21.0"/>
  86.     </external>
  87.   
  88. </map>
复制代码

该用户从未签到

发表于 2013-4-24 08:05:40 | 显示全部楼层
不知道 是不是osgearth_viewer 就设定了背景,等待 OE 大牛来解释吧

该用户从未签到

发表于 2013-4-24 11:25:03 | 显示全部楼层
1.背景问题,boston.earth里的<sky hours="21.0"/>标签就添加了天空属性和时间属性;
2.你的意思是想用"平面"的方式来展示地图吧?<map name="Boston Demo" type="geocentric" version="2">  这里的geocentric改为projected。

该用户从未签到

 楼主| 发表于 2013-4-24 13:25:00 | 显示全部楼层
cmygiser 发表于 2013-4-24 11:25
1.背景问题,boston.earth里的标签就添加了天空属性和时间属性;
2.你的意思是想用"平面"的方式来展示地图 ...

第二个我没说清楚可能,我的背景指的就是宇宙背景 ,我想把地球去掉,不是吧地球铺平

该用户从未签到

发表于 2013-4-24 13:55:52 | 显示全部楼层
本帖最后由 cmygiser 于 2013-4-24 13:56 编辑

感觉这样做是在踢osgEarth的馆子
你不要earth了,那你用osgEarth干啥?

该用户从未签到

 楼主| 发表于 2013-4-24 23:47:37 | 显示全部楼层
本帖最后由 lanbomegp 于 2013-4-24 23:48 编辑
cmygiser 发表于 2013-4-24 13:55
感觉这样做是在踢osgEarth的馆子
你不要earth了,那你用osgEarth干啥?


哈哈,您说的是。我去看看,谢谢回复。

该用户从未签到

发表于 2016-12-8 22:49:56 | 显示全部楼层
您 好,您这个问题是怎么解决的?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

OSG中国官方论坛-有您OSG在中国才更好

网站简介:osgChina是国内首个三维相关技术开源社区,旨在为国内更多的技术开发人员提供最前沿的技术资讯,为更多的三维从业者提供一个学习、交流的技术平台。

联系我们

  • 工作时间:09:00--18:00
  • 反馈邮箱:1315785073@qq.com
快速回复 返回顶部 返回列表