三维场景中模型纹理按距离压缩方法,在ArcEngine中的接口为
pGlobeLayerProperties5.SetDistanceThresholdsExt(lodShift0, maxDistance0, lodShift1, maxDistance1, lodShift2);
具体的应用方式为
//获取要进行纹理压缩控制的图层,getLayerFromScene为遍历GlobeControl中所有图层的函数
ILayer layer = Common.GlobeUtil.getLayerFromScene(_globeCtrl3D.GlobeDisplay.Scene, "Buildings");
IGlobeDisplayLayers2 pGlobeDisplayLayers2 = _globeCtrl3D.GlobeDisplay as IGlobeDisplayLayers2;
IGlobeLayerProperties5 pGlobeLayerProperties5 = pGlobeDisplayLayers2.FindGlobeProperties(layer) as IGlobeLayerProperties5;
int lodShift0 = 0;
double maxDistance0 = 30;
int lodShift1 = 1;
double maxDistance1 = 50;
int lodShift2 = 0;
//double maxDistance2 = 0;
//获取压缩距离
pGlobeLayerProperties5.GetDistanceThresholdsExt(out lodShift0, out maxDistance0, out lodShift1, out maxDistance1, out lodShift2);
lodShift0 = 0;
maxDistance0 = (double)numericUpDown1.Value;
lodShift1 = 1;
maxDistance1 = (double)numericUpDown2.Value;
lodShift2 = 2;
//double maxDistance2 = 0;
//设置压缩距离
pGlobeLayerProperties5.SetDistanceThresholdsExt(lodShift0, maxDistance0, lodShift1, maxDistance1, lodShift2);
pGlobeLayerProperties5.ApplyDisplayProperties(layer);
_globeCtrl3D.GlobeDisplay.RefreshViewers();
可以设置为2级,即第一级距离内的为精模型,第一级和第二级之间的为经过纹理压缩的模型,第三极之外为白模型
如下图
30-50米
30-80米
60-80米