似乎无法制作功能性 THREE.js collada 加载器
我在获取没有内置相机或灯光渲染的定制 collada 对象时遇到问题。我或多或少复制了我在一些 collada 示例中看到的内容来创建我自己的加载器,如下所示:
var loader = new THREE.ColladaLoader();
var room, scene, stats;
loader.load('../Models/Rooms/boot.dae', function colladaReady( collada ){
collada.scene.getChildByName('Cube',true).doubleSided = true;
room = collada.scene;
room.scale.x = room.scale.y = room.scale.z = 1;
room.updateMatrix();
init();
});
init 函数相当基本,看起来像这样
scene = new THREE.Scene();
scene.add( room );
scene.add( camera );
renderer.render(scene, camera);
这里是我尝试渲染的实际对象。我还尝试了示例文件夹中的 monster.dae 文件,但没有成功。 Chrome javascript 控制台没有显示任何错误,所以我不太确定在哪里查看代码。这一切都类似于功能性示例,所以我不确定为什么它不起作用。有什么我不知道的与 collada 加载相关的东西吗?
I'm having issues getting a custom made collada object with no built in camera or lighting to render. I more or less copied what I had seen in a few collada examples to create my own loader, which looks like this:
var loader = new THREE.ColladaLoader();
var room, scene, stats;
loader.load('../Models/Rooms/boot.dae', function colladaReady( collada ){
collada.scene.getChildByName('Cube',true).doubleSided = true;
room = collada.scene;
room.scale.x = room.scale.y = room.scale.z = 1;
room.updateMatrix();
init();
});
The init function is fairly basic and looks like this
scene = new THREE.Scene();
scene.add( room );
scene.add( camera );
renderer.render(scene, camera);
Here is the actual object I'm trying to render. I have also tried it out with the monster.dae file that is in the examples folder without success. The Chrome javascript console isn't showing any errors, so I'm not quite sure where to look in my code. It all resembles functional examples, so I'm not sure why it's not functional. Is there something I'm unaware of that is relevant to collada loading?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已解决:该项目正在渲染,但没有与之关联的皮肤或纹理。因此它以与背景相同的颜色进行渲染,可以理解的是,它看起来根本没有渲染。通过在地面上添加网格只是为了检查而发现的。
RESOLVED: The item was rendering, but had no skin or texture associated with it. So it was rendering at the same colour as the background, which understandably appears to not be rendering at all. Discovered by adding a grid to the ground just to check.