lanbomegp 发表于 2013-4-23 20:38:07

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

我现在使用osgearth_viewer 观察boston.earth是正常的,我将boston.earth拷贝到osg工程下,在一个简单的osg程序中加载boston.earth,结果出现如图的情况,请问:
1 是什么原因造成的,那些背景去哪里了?
2 拿boston.earth这个文件来说,有没有办法可以去掉它里面的地球,同时保留星空背景啊、太阳什么的?是要修改earth文件吗?请各位指点一二,不胜感激。

boston.earth的代码,需要的话,大概要改什么地方?<!--
osgEarth Sample.

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

<map name="Boston Demo" type="geocentric" version="2">
   
    <image name="ReadyMap.org - Imagery" driver="tms">
      <url>http://readymap.org/readymap/tiles/1.0.0/22/</url>
    </image>
      
    <model name="buildings" driver="feature_geom">
            
      <features name="buildings" driver="ogr">
            <url>../data/boston_buildings_utm19.shp</url>
            <build_spatial_index>true</build_spatial_index>
      </features>
      
      <feature_indexing>true</feature_indexing>
      
      <fade_in_duration>1.0</fade_in_duration>
      
      <!--
         The "layout" element activates tiling and paging of the feature set. If you
         omit the layout element, the entire feature set will render as one pre-loaded
         model (no tiling or paging).
         
         Each "level" is a level of detail for features, and should select a style
            to use for that level. It also can specify min and max camera ranges,
            in meters.
            
         The "tile size factor" controls how a feature is tiled. The higher this factor,
            the smaller the tile size, and the more tiles will be used to render a given
            level of detail. The default is 15. (The renderer multiplies a tile's radius
            by the tile_size_factor to calculate the maximum suitable camera range for
            a given level of subdivision. It compares this to the feature level's max
            range to decide how many tiles to create.)
      -->
      
      <layout>
            <tile_size_factor>45</tile_size_factor>
            <level name="default" max_range="20000">
                <selector class="buildings"/>
            </level>
      </layout>
      
      <styles>            
            <library name="us_resources">
                <url>../data/resources/textures_us/catalog.xml</url>
            </library>
            
            <style type="text/css">
                buildings {
                  extrusion-height:      3.5 * max(, 1);
                  extrusion-flatten:   true;
                  extrusion-wall-style:building-wall;
                  extrusion-wall-gradient: 0.8;
                  extrusion-roof-style:building-rooftop;
                  altitude-clamping:   none;
                }            
                building-wall {
                  skin-library:   us_resources;
                  skin-tags:      building;
                  skin-random-seed: 1;
                  fill:             #ffffff;
                }
                building-rooftop {
                  skin-library:   us_resources;
                  skin-tags:      rooftop;
                  skin-tiled:       true;
                  skin-random-seed: 1;
                  fill:             #ffffff;
                }
            </style>
      </styles>   
    </model>
   
    <external>
      <viewpoints>
            <viewpoint name="Boston Overview" heading="24.261" height="0" lat="42.34425" long="-71.076262" pitch="-21.6" range="3450"/>
            <viewpoint name="Boston Downtown 1" heading="117" lat="42.3568" long="-71.0585" height="0" pitch="-20.4" range="1500" />
            <viewpoint name="Boston Downtown 2" heading="-128.5" lat="42.3582" long="-71.0546" height="0" pitch="-19" range="1620" />
            <viewpoint name="Boston Street Level" heading="-145.85" lat="42.36460" long="-71.053612" pitch="-10.1" range="85.034"/>
      </viewpoints>
      <sky hours="21.0"/>
    </external>

</map>

liuzhiyu123 发表于 2013-4-24 08:05:40

不知道 是不是osgearth_viewer 就设定了背景,等待 OE 大牛来解释吧

cmygiser 发表于 2013-4-24 11:25:03

1.背景问题,boston.earth里的<sky hours="21.0"/>标签就添加了天空属性和时间属性;
2.你的意思是想用"平面"的方式来展示地图吧?<map name="Boston Demo" type="geocentric" version="2">这里的geocentric改为projected。

lanbomegp 发表于 2013-4-24 13:25:00

cmygiser 发表于 2013-4-24 11:25 static/image/common/back.gif
1.背景问题,boston.earth里的标签就添加了天空属性和时间属性;
2.你的意思是想用"平面"的方式来展示地图 ...

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

cmygiser 发表于 2013-4-24 13:55:52

本帖最后由 cmygiser 于 2013-4-24 13:56 编辑

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

lanbomegp 发表于 2013-4-24 23:47:37

本帖最后由 lanbomegp 于 2013-4-24 23:48 编辑

cmygiser 发表于 2013-4-24 13:55 static/image/common/back.gif
感觉这样做是在踢osgEarth的馆子
你不要earth了,那你用osgEarth干啥?

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

laihan1227 发表于 2016-12-8 22:49:56

您 好,您这个问题是怎么解决的?
页: [1]
查看完整版本: osg加载boston.earth 出现异常 求助~