想要给forge的外面去添加一个天空盒,把场景弄的更好看,怎么去实现,试过three.js成功了但是forge好像做了改动,先是报错THREE.CubeTextureLoader is not a constructor这是因为forge所用的three.js版本的问题吗? 然后新建一个盒子但是出现了新的问题,视角好像被切掉了一样。截图和代码如下:
var materialArr=[];
var directions = ["aa_RT","aa_LF","aa_UP","aa_DN","aa_FR","aa_BK"] ;
for (var i = 0; i < 6; i++){
materialArray.push( new THREE.MeshBasicMaterial({
map: THREE.ImageUtils.loadTexture( "lib/img/aa/"+ directions[i] + ".jpg" ),
side: THREE.BackSide
}));
}
var skyBoxGeom = new THREE.CubeGeometry(80,80,80);
var skyBoxMaterial = new THREE.MeshFaceMaterial(materialArr);
var skyBox = new THREE.Mesh(skyBoxGeom,skyBoxMaterial);
viewer.impl.scene.add(skyBox);
在stackoverflow上看到了大神给的解决方法,大致意思是要加载另一个范围更大的模型,这样剪裁面就会自动更新。大神的原话我翻译不好就直接粘原话了,如下:
详情请查看https://stackoverflow.com/que...,同时也给出了扩展地址https://github.com/Autodesk-F...
因forge github文件地址修改现已经修正文件地址