首页 > 编程知识 正文

contextcapture破解,unity屏幕坐标转换为世界坐标

时间:2023-05-06 06:38:03 阅读:285626 作者:468

这是cc导出来的cesium项目目录:

这个是index.html:

下面的代码是main.js

// 设置你的bing地图key

Cesium.BingMapsApi.defaultKey = 'Ap2z3Su_tKy7X9Zdy5EuFqzLmEa6bPKtLCS8_Gnsq-btg91SoZDGTto22NoEO4FB';

//构造地形源的默认列表

var terrainModels = Cesium.createDefaultTerrainProviderViewModels();

//用我们需要的基本应用程序来构造查看器

var viewer = new Cesium.Viewer('cesiumContainer', {

timeline:false,

animation:false,

vrButton:true,

sceneModePicker:false,

infoBox:true,

scene3DOnly:true,

terrainProviderViewModels: terrainModels,

selectedTerrainProviderViewModel: terrainModels[1] // 选择STK高分辨率地形

});

// No depth testing against the terrain to avoid z-fighting

viewer.scene.globe.depthTestAgainstTerrain =false;

//添加奔特力的logo

viewer.scene.frameState.creditDisplay.addDefaultCredit(new Cesium.Credit('Cesium 3D Tiles produced by Bentley ContextCapture', 'Resources/logoBentley.png', 'http://www.bentley.com/'));

//创建视角包围球

var boundingSphere = new Cesium.BoundingSphere(Cesium.Cartesian3.fromDegrees(114.3471862, 22.71530611, 141.5000843), 130.8524335);

// 重载home键的行为

viewer.homeButton.viewModel.command.beforeExecute.addEventListener(function(commandInfo) {

//飞到自定义位置

viewer.camera.flyToBoundingSphere(boundingSphere);

//告诉home键不要做任何事情。

commandInfo.cancel = true;

});

//设置自定义初始位置

viewer.camera.flyToBoundingSphere(boundingSphere, {duration: 0});

// 用于调整屏幕空间错误和内存使用的功能

var isMobile = {

Android: function() {

return navigator.userAgent.match(/Android/i);

},

BlackBerry: function() {

return navigator.userAgent.match(/BlackBerry/i);

},

iOS: function() {

return navigator.userAgent.match(/iPhone|iPad|iPod/i);

},

Opera: function() {

return navigator.userAgent.match(/Opera Mini/i);

},

Windows: function() {

return navigator.userAgent.match(/IEMobile/i);

},

any: function() {

return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());

}

};

// 添加 tileset.不要忘记将默认屏幕空间错误减少到1

var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({

url: '../Scene/cesium_3d_tite.json',

maximumScreenSpaceError : isMobile.any() ? 8 : 1, // Temporary workaround for low memory mobile devices - Increase maximum error to 8.

maximumNumberOfLoadedTiles : isMobile.any() ? 10 : 1000 // Temporary workaround for low memory mobile devices - Decrease (disable) tile cache.

}));

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。