日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

cesium 构建天空盒

發(fā)布時間:2023/12/31 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 cesium 构建天空盒 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

我們用typescript 實現(xiàn) cesium 天空盒子

let skyBox = {
//會直接關(guān)閉大氣層(存在大氣層,近景效果不佳)
nearSkyBox: {
positiveX: “./images/skybox/03/px.jpg”,
positiveY: “./images/skybox/03/py.jpg”,
positiveZ: “./images/skybox/03/pz.jpg”,
negativeX: “./images/skybox/03/nx.jpg”,
negativeY: “./images/skybox/03/ny.jpg”,
negativeZ: “./images/skybox/03/nz.jpg”,
},
farDistance: 5500,
farSkyBox: {
positiveX: “./images/skybox/04/px.jpg”,
positiveY: “./images/skybox/04/py.jpg”,
positiveZ: “./images/skybox/04/pz.jpg”,
negativeX: “./images/skybox/04/nx.jpg”,
negativeY: “./images/skybox/04/ny.jpg”,
negativeZ: “./images/skybox/04/nz.jpg”,
},
};
let skyBox = new SkyBox(viewer, skyBox);//設(shè)置天空盒
我們定義參數(shù)類

export interface PskyboxSource {
positiveX: String,
negativeX: String,
positiveY: String,
negativeY: String,
positiveZ: String,
negativeZ: String
}
export interface PSkyBox {
nearSkyBox?: PskyboxSource,//近景的天空盒
farDistance?: Number,//近景和遠景的分割距離
farSkyBox?: PskyboxSource,//遠景的天空盒
}
我們定義SkyBox 基類

const BoxGeometry = Cesium.BoxGeometry; const Cartesian3 = Cesium.Cartesian3; const defaultValue = Cesium.defaultValue; const defined = Cesium.defined; const destroyObject = Cesium.destroyObject; const DeveloperError = Cesium.DeveloperError; const GeometryPipeline = Cesium.GeometryPipeline; const Matrix3 = Cesium.Matrix3; const Matrix4 = Cesium.Matrix4; const Transforms = Cesium.Transforms; const VertexFormat = Cesium.VertexFormat; const BufferUsage = Cesium.BufferUsage; const CubeMap = Cesium.CubeMap; const DrawCommand = Cesium.DrawCommand; const loadCubeMap = Cesium.loadCubeMap; const RenderState = Cesium.RenderState; const VertexArray = Cesium.VertexArray; const BlendingState = Cesium.BlendingState; const SceneMode = Cesium.SceneMode; const ShaderProgram = Cesium.ShaderProgram; const ShaderSource = Cesium.ShaderSource; //片元著色器,直接從源碼復(fù)制 const SkyBoxFS = "uniform samplerCube u_cubeMap;\n\ varying vec3 v_texCoord;\n\ void main()\n\ {\n\ vec4 color = textureCube(u_cubeMap, normalize(v_texCoord));\n\ gl_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n\ }\n\ ";//頂點著色器有修改,主要是乘了一個旋轉(zhuǎn)矩陣 const SkyBoxVS = "attribute vec3 position;\n\ varying vec3 v_texCoord;\n\ uniform mat3 u_rotateMatrix;\n\ void main()\n\ {\n\ vec3 p = czm_viewRotation * u_rotateMatrix * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));\n\ gl_Position = czm_projection * vec4(p, 1.0);\n\ v_texCoord = position.xyz;\n\ }\n\ "; /**為了兼容高版本的Cesium,因為新版cesium中g(shù)etRotation被移除 */ if (!Cesium.defined(Cesium.Matrix4.getRotation)) { Cesium.Matrix4.getRotation = Cesium.Matrix4.getMatrix3 } const skyboxMatrix3 = new Matrix3(); /**近景天空盒 */ export class SkyBoxOnGround {sources: any; _sources: any = undefined; show: boolean = true; _command: any; _cubeMap: any; _attributeLocations: any; _useHdr: any; constructor(options: any) { super(); this.sources = options.sources; this.show = options.show || true; this._command = new DrawCommand({ modelMatrix: Matrix4.clone(Matrix4.IDENTITY), owner: this }); this._cubeMap = undefined; this._attributeLocations = undefined; this._useHdr = undefined; } update(frameState: any, useHdr: any) { const that = this; if (!this.show) { return undefined; } if ((frameState.mode !== SceneMode.SCENE3D) && (frameState.mode !== SceneMode.MORPHING)) { return undefined; }if (!frameState.passes.render) { return undefined; }const context = frameState.context;if (this._sources !== this.sources) { this._sources = this.sources; const sources = this.sources; if ((!defined(sources.positiveX)) || (!defined(sources.negativeX)) || (!defined(sources.positiveY)) || (!defined(sources.negativeY)) || (!defined(sources.positiveZ)) || (!defined(sources.negativeZ))) { throw new DeveloperError('this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.'); }if ((typeof sources.positiveX !== typeof sources.negativeX) || (typeof sources.positiveX !== typeof sources.positiveY) || (typeof sources.positiveX !== typeof sources.negativeY) || (typeof sources.positiveX !== typeof sources.positiveZ) || (typeof sources.positiveX !== typeof sources.negativeZ)) { throw new DeveloperError('this.sources properties must all be the same type.'); }if (typeof sources.positiveX === 'string') { // Given urls for cube-map images. Load them. loadCubeMap(context, this._sources).then(function (cubeMap:any) { that._cubeMap = that._cubeMap &amp;&amp; that._cubeMap.destroy(); that._cubeMap = cubeMap; }); } else { this._cubeMap = this._cubeMap &amp;&amp; this._cubeMap.destroy(); this._cubeMap = new CubeMap({ context: context,</code></pre></li>更多參考 https://xiaozhuanlan.com/topic/0946827135

總結(jié)

以上是生活随笔為你收集整理的cesium 构建天空盒的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 欧美午夜性 | 欧美午夜在线 | 国产女人在线 | 91禁国产网站 | 红桃视频在线播放 | 国产成人精品影院 | 日本三级韩国三级美三级91 | 国产精品啪啪啪视频 | 精品少妇久久 | 五月激情天 | 9l视频自拍蝌蚪9l视频成人 | 伊人久久超碰 | 亚洲视频免费播放 | 特级黄毛片 | 激情四虎 | 免费的理伦片在线播放 | 日韩在线视频免费观看 | 日韩全黄 | 黄网站在线观看视频 | 国产亚洲欧洲 | 国产欧美精品在线观看 | 久久青 | 国产一区二区三区成人 | 成人一区二区精品 | av观看网| 国模吧一区二区三区 | 羞羞涩涩视频 | 私人av| 人成免费| 涩涩视频网址 | 精品欧美一区二区在线观看 | 原来神马电影免费高清完整版动漫 | 亚洲狠狠爱 | 黄色一级大片在线免费看国产一 | 国模精品一区二区三区 | 99热这里只有精品18 | 91色| 加勒比精品 | 草草影院av | 色婷婷久久一区二区三区麻豆 | 91av一区二区三区 | 色播在线视频 | 欧美黄色免费在线观看 | 日韩欧美精品国产 | 小俊大肉大捧一进一出好爽 | 久久精品国产亚洲AV成人婷婷 | 国产精品无码99re | 大奶在线观看 | 国产精品扒开腿做爽爽爽a片唱戏 | 粉嫩av一区二区三区四区五区 | 亚洲色图另类图片 | 外国av在线| 97在线影院| 鲁丝一区二区 | 日本成人福利视频 | 日韩av伦理 | 一进一出好爽视频 | 精品久久久久一区 | 日本美女逼| 3d动漫精品啪啪一区二区免费 | 国产精品视频网站 | 91成人国产综合久久精品 | 黄站在线观看 | 天天操夜夜爽 | 天天爽网站 | av在线一区二区三区 | 成人综合在线视频 | 国语对白精彩对话 | 国产精品刘玥久久一区 | 成人91 | 国产精品一线天粉嫩av | 熟女毛毛多熟妇人妻aⅴ在线毛片 | 国产精品蜜 | 国产一区二区三区四区五区六区 | 少妇日皮视频 | 亚洲午夜视频 | 国产精品.www | 传媒av在线| 青春草在线视频免费观看 | 色婷av| 综合网五月 | 日韩一级中文字幕 | www.黄色av | 五月天久久久 | 中日韩在线| 亚洲精品成a人在线观看 | 免费啪视频在线观看 | 日本国产在线播放 | 黑人乱码一区二区三区av | 国产精彩视频 | 欧美激情在线播放 | 中文字幕免费在线视频 | 男女网站在线观看 | 在线a毛片 | 久久久久这里只有精品 | 欧美性猛交xxxx免费看久久久 | 久久99热这里只频精品6学生 | 毛片网络 | 午夜精品区 |